在Excel中使用VBA 有没有办法将工作表的标签名称从小写更改为大写?
我有一张超过50张的工作簿,单独更改名称似乎不是一个非常有吸引力的选项。
电子表格的名称位于单元格A1中,已大写。只需要将实际的工作表名称设为大写。
答案 0 :(得分:2)
类似的东西:
for each ws in Workbooks("").worksheets
ws.name = ucase(ws.name)
'or
ws.name = ucase(ws.range("A1"))
next
答案 1 :(得分:0)
你走了:
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