請幫我改變下面的代碼。需要通過InputBox
重命名工作表基於INPUT BOX
由於選擇重命名小區
Sub RenWSs()
Dim WS As Worksheet
Dim shtName
Dim newName As String
Dim i As Integer
For Each WS In Worksheets
With WS
If Trim(.Range("c14")) <> "" Then
shtName = Split(Trim(.Range("c14")), " ")
newName = shtName(0)
On Error GoTo ws_name_error
.Name = newName
GoTo done
repeat:
.Name = newName & i
GoTo done
ws_name_error:
i = i + 1
Resume repeat
End If
End With
On Error GoTo 0
done:
Next
End Sub
?輸入單元格的地址,如「C4」?或者輸入當前電路圖的新名稱? –
進入單元格「C4」單元格 –
請參閱我的回答以下兩種使用「InputBox」選擇單元格的方法 –