新增工作表
指定名字,位置等等
Sub 指定位置插入指定名的sheet()
Dim wb As Workbook
Dim sh As Worksheet
Set wb = ThisWorkbook
Rem Sheets.Add(before:=Sheets("e_1"), after:=Sheets("e_2")).Name = "newsheet"
Rem before after没成功同时生效过,数量,type? 参数之间用, ???
Sheets.Add(after:=Sheets("e_2")).Name = "newsheet"
End Sub
然后,多个sheet呢
Sub 加一批表()
Dim arr1
arr1 = Array("a", "b", "c", "d") 'arr1()=这样不行?
For i = 0 To UBound(arr1)
Sheets.Add
ActiveSheet.Name = arr1(i)
Rem ActiveSheet.Close '不支持 activesheet.close? 也不用关?
Next
End Sub
Sub 加一批表()
Dim arr1
arr1 = Array("a", "b", "c", "d") 'arr1()=这样不行?
arr2 = Sheets("e_1").Range("a1:a3") '数组应该不是对象,赋值不用set
For i = 0 To UBound(arr1)
Sheets.Add
ActiveSheet.Name = arr1(i)
Rem ActiveSheet.Close '不支持 activesheet.close? 也不用关?
Next
Rem 二维数组,记住 x y 坐标系分别是 row column
For j = 1 To UBound(arr2, 1) '这里是从EXCEL二维表里取的数组,index不能为0开始
Sheets.Add
ActiveSheet.Name = arr2(j, 1) '记得这是从二维数组里取数。二维数组其实就是EXCEL表。
Next j
End Sub
11111111111
Sheets.Add(Before:=Sheets(1)).Name = "DataSheet4"