请教各位大佬,如何在新建表格时候,重新命名sheet名称,跪求。
vb吧
全部回复
仅看楼主
level 2
目前可以实现把表格中的sheet另存为独立表格,因为系统要求独立表格的sheet命名必须为“sheet1”,否则无法导入,现在请问大佬们如何,可否在下列代码中增加一行 重新命名sheet的命令,要如何增加,感谢。
Sub 按钮5_Click()
Application.ScreenUpdating = False
For Each sht In Sheets
sht.Copy
ActiveWorkbook.SaveAs "C:\Users\Administrator\Desktop\新建文件夹\" & sht.name
ActiveWorkbook.Close
Next
Application.ScreenUpdating = True
End Sub
2022年09月09日 09点09分 1
level 12
for each 上面添加个
for each sht in sheet
sht.name=int(rnd*10) & int(rnd*10) & int(rnd*10) & int(rnd*10) & int(rnd*10)
next
下面的for each 里面sht.copy前面加入
sht.name="sheet1"
next 前面加上
sht.name=int(rnd*10) & int(rnd*10) & int(rnd*10) & int(rnd*10) & int(rnd*10)
意思就是先用随机数给所有sheet重命名,然后在复制保存前修改为 sheet1,保存后再改成随机数字
2022年09月23日 06点09分 3
1