B
Bill_Green via OfficeKB.com
I am trying to make 87 sheets in a workbook change their name to reflect that
of what is in cell B1. Is there a way to do that in VBA? I've tried it onthe
first one and here's the code I've entered:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B1"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.Name = Target.Value
End If
ws_exit:
Application.EnableEvents = True
End Sub
I just right clicked the tab, clicked "view code" and inserted this (it's
from a previous post. I'm a novice, but am working on it). Assuming this can
be made to work, is there a way to make this loop through all the sheets
instead of doing this one at a time? This will be a monthly task.
of what is in cell B1. Is there a way to do that in VBA? I've tried it onthe
first one and here's the code I've entered:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B1"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.Name = Target.Value
End If
ws_exit:
Application.EnableEvents = True
End Sub
I just right clicked the tab, clicked "view code" and inserted this (it's
from a previous post. I'm a novice, but am working on it). Assuming this can
be made to work, is there a way to make this loop through all the sheets
instead of doing this one at a time? This will be a monthly task.