Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Automating Tab names
Hi.. On this site, I found this VBA code for naming tabs with entry in a
particular cell, but it's not working... I only changed the "a2" part to correspond to my particular case, and left everything else alone. What could be wrong? __________ Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) ActiveSheet.Name = Range("a2").Value End Sub ___________ Thanks in advance |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Automating Tab names
That code needs to be in the Thisworkbook code module, and it should be
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$A$2" Then sh.Name = Target.Value End If End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Stilla" wrote in message ... Hi.. On this site, I found this VBA code for naming tabs with entry in a particular cell, but it's not working... I only changed the "a2" part to correspond to my particular case, and left everything else alone. What could be wrong? __________ Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) ActiveSheet.Name = Range("a2").Value End Sub ___________ Thanks in advance |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Automating Tab names
Stilla
Not sure of what you want to do. I think you want the name of each sheet to change to the value of A2 when that sheet is selected (activated). If this is so use this: Post back if this is not what you want. HTH Otto Private Sub Workbook_SheetActivate(ByVal Sh As Object) ActiveSheet.Name = Range("a2").Value End Sub "Stilla" wrote in message ... Hi.. On this site, I found this VBA code for naming tabs with entry in a particular cell, but it's not working... I only changed the "a2" part to correspond to my particular case, and left everything else alone. What could be wrong? __________ Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) ActiveSheet.Name = Range("a2").Value End Sub ___________ Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automating Worksheet Names | Excel Worksheet Functions | |||
The filter didn't show all (2,254) names when I set it up | Excel Discussion (Misc queries) | |||
Convert Local Names to Global Names | Excel Worksheet Functions | |||
Visual Basics - Automating Specific Sheet Names | Excel Discussion (Misc queries) | |||
sorting names alphabetically when names may start with numbers | Excel Discussion (Misc queries) |