ActiveSheet.Name = Range("B2").Value
Sub Sheet_Names()
Application.ScreenUpdating = False
Dim i As Long
For i = 1 To Sheets.Count
Sheets(i).Name = Sheets(i).Cells(2, 2).Value
Next
Application.ScreenUpdating = True
End Sub
Sub test()
ActiveSheet.Name = Range("B2").Value
MsgBox Range("B2").Value
End Sub
Just want to apply to one sheet only.
Try this vba code in different workbooks and nothing.
Sub test()
ActiveSheet.Name = Range("B2").Value
End Sub
What do you suggest?
Thanks.
Simple Question:
Have in cell B2 the name of my customer that would like that sheet name return the same equal name in B2.
How to do so?
Thanks for the great advice.
Excel 2007 | |||
---|---|---|---|
B | |||
2 | Customer1 | ||
Sheet1 |
Excel 2007 | |||
---|---|---|---|
B | |||
2 | Customer1 | ||
Customer1 |
Excel 2007 | |||
---|---|---|---|
B | |||
2 | Customer2 | ||
Sheet2 |
Excel 2007 | |||
---|---|---|---|
B | |||
2 | Customer2 | ||
Customer2 |
Sub RenameActiveSheet()
' hiker95, 12/28/2016, ME982790
With ActiveSheet
If Not .Range("B2") = vbEmpty Then
.Name = .Range("B2").Value
End If
End With
End Sub
Dear igold and Dear hiker95,
Congratulations!!!
Both of you were right.
Both of vba codes work correct only if you first take the steps (1-8) that hiker95 wrote before.
Thanks again gentlemen.