excel新建工作表并重命名
已经有3个默认工作表,其中sheet1里面已经有数据现在,我要增加15个工作表,(共18个)。全部重命名为引号里的那些Array("桃花河大桥","新房子中桥","新城坝...
已经有3个默认工作表,其中sheet1里面已经有数据
现在,我要增加15个工作表,(共18个)。
全部重命名为 引号里的那些 Array( "桃花河大桥","新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
请问代码是什么 展开
现在,我要增加15个工作表,(共18个)。
全部重命名为 引号里的那些 Array( "桃花河大桥","新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
请问代码是什么 展开
3个回答
展开全部
Sub test()
Dim i As Variant
Dim j As Integer
Dim sht As Worksheet
i = Array("桃花河大桥", "新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
For j = 1 To 3
Worksheets(j).Name = i(j - 1)
Next
For j = 4 To 18
Set sht = Worksheets.Add(after:=Worksheets(j - 1))
sht.Name = i(j - 1)
Next
End Sub
Dim i As Variant
Dim j As Integer
Dim sht As Worksheet
i = Array("桃花河大桥", "新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
For j = 1 To 3
Worksheets(j).Name = i(j - 1)
Next
For j = 4 To 18
Set sht = Worksheets.Add(after:=Worksheets(j - 1))
sht.Name = i(j - 1)
Next
End Sub
展开全部
Sub aa()
Dim i: i = Array("桃花河大桥", "新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
Dim j%
For j = LBound(i) To UBound(i)
With Worksheets.Add(after:=Worksheets(Worksheets.Count))
.Name = i(j)
End With
Next
End Sub
Dim i: i = Array("桃花河大桥", "新房子中桥", "新城坝中桥", "新城坝1#大桥", "新城坝2#大桥", "大河沟大桥", "沙田河大桥", "洞明村大桥", "磨湾山右线中桥", "磨湾山大桥", "麻柳井大桥", "黄泥田大桥", "刘家湾大桥", "石牛坝大桥", "华头嘴大桥", "陈深沟大桥", "梓江大桥", "金华互通匝道桥")
Dim j%
For j = LBound(i) To UBound(i)
With Worksheets.Add(after:=Worksheets(Worksheets.Count))
.Name = i(j)
End With
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在sheet1处右键点击增加工作表即可,双击sheet1可以更改名称。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询