EXCEL高手你好,在EXCEL A列中给出文件名,在指定的文件夹下自动生产EXCEL文件,怎样实现?

生成的新文件内容为sheet2中的内容
2025-01-05 11:22:22
推荐回答(3个)
回答(1):

代码如下:
Sub 生成工作簿()
t = "d:/" '保存路径
For i = 1 To [a65536].End(xlUp).Row
Set newbook = Workbooks.Add '建立一个新的工作簿
With newbook '设置属性
.SaveAs Filename:=t & Cells(i, 1) & ".xls"
.Close
End With
Next
End Sub

回答(2):

是要生成空白的excel文件吗?
dim str as string
dim i ,j as long
j=Application.WorksheetFunction.CountA(Range("A:A")) 'A列总共的个数
for i = 1 to j
str=worksheets("sheet1").cells(i,1)
Workbooks.Add
ActiveWorkbook.SaveAs _
Filename:"c:\“&str&”.xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
next

回答(3):

如果是自动打开可以用超级链接