【发布时间】:2015-08-11 20:06:34
【问题描述】:
在 Excel 中使用 VBA有没有办法将工作表的选项卡名称从小写更改为大写?
我有一本超过 50 张工作簿,单独更改名称似乎不是一个非常吸引人的选择。
电子表格的名称在单元格 A1 中并且已经大写。只需要实际工作表名称为大写即可。
【问题讨论】:
在 Excel 中使用 VBA有没有办法将工作表的选项卡名称从小写更改为大写?
我有一本超过 50 张工作簿,单独更改名称似乎不是一个非常吸引人的选择。
电子表格的名称在单元格 A1 中并且已经大写。只需要实际工作表名称为大写即可。
【问题讨论】:
类似:
for each ws in Workbooks("").worksheets
ws.name = ucase(ws.name)
'or
ws.name = ucase(ws.range("A1"))
next
【讨论】:
给你:
Sub Lower2UpperCase()
Dim wB As Workbook, _
wS As Worksheet
Set wB = ActiveWorkbook
For Each wS In wB.Worksheets
'Only thing needed if ALL of your sheets'name are in A1 in Upper case :
wS.Name = wS.Range("A1")
'If all the sheets'name are in A1 but not all in Upper case :
'wS.Name = UCase(wS.Range("A1"))
'Take the name of the sheet and change the case to all Upper case :
'wS.Name = UCase(wS.Name)
Next wS
End Sub
【讨论】: