批量新建工作表,并用某列数据命名,VBA程序,或其他方法
发布网友
发布时间:2022-04-29 13:12
我来回答
共3个回答
热心网友
时间:2022-06-28 14:57
Sub 添加工作表2()
Dim Sh As Worksheet, i As Long
Sheets.Add After:=Sheets(Sheets.Count), Count:=Worksheets(1).Range("A" & Rows.Count).End(xlUp).Row - 1
For i = 2 To Sheets.Count
Worksheets(i).Name = Worksheets(1).Cells(i, 1).Value
Worksheets(i).Range("B4").Value = Worksheets(1).Cells(i, 1).Value
Next
End Sub
热心网友
时间:2022-06-28 14:58
Sub mysub()
Dim sheetName As String
Dim sht As Worksheet
Dim currentSht As Worksheet
Set currentSht = ActiveSheet
For i = 2 To Range("A65536").End(xlUp).Row
sheetName = Cells(i, 1).Value
Set sht = ActiveWorkbook.Worksheets.Add(after:=currentSht)
sht.Name = sheetName
sht.[B4] = sheetName
Set currentSht = sht
Next
End Sub
这个简单啊
热心网友
时间:2022-06-28 14:58
A列有标题行吗?把数据文件发我,试帮您解决