![]() |
Naming a sheet
Hello
Account Numbers are in B3 Can someone help me with how to name a sheet with IF B3 = V014989 Then SheetName = 101 IF B3 = V015013 Then SheetName = 102 This is what i have which returns the Private Sub SheetName() On Error Resume Next ActiveSheet.Name = Range("B3") & Format(Now(), "[$-409] yy-mmm-d;@") If Err.Number < 0 Then MsgBox Err.Number & " -- " & Err.Description End If On Error GoTo 0 Thanks Mike |
Naming a sheet
Is it just
Private Sub SheetName() With ActiveSheet If .Range("B3").Value = " V014989" Then .Name = "101" ElseIf .Range("B3").Value = "V015013" Then .Name = "102" End If End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Mike" wrote in message ... Hello Account Numbers are in B3 Can someone help me with how to name a sheet with IF B3 = V014989 Then SheetName = 101 IF B3 = V015013 Then SheetName = 102 This is what i have which returns the Private Sub SheetName() On Error Resume Next ActiveSheet.Name = Range("B3") & Format(Now(), "[$-409] yy-mmm-d;@") If Err.Number < 0 Then MsgBox Err.Number & " -- " & Err.Description End If On Error GoTo 0 Thanks Mike |
Naming a sheet
Bet what if I need to add more later
"Bob Phillips" wrote: Is it just Private Sub SheetName() With ActiveSheet If .Range("B3").Value = " V014989" Then .Name = "101" ElseIf .Range("B3").Value = "V015013" Then .Name = "102" End If End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Mike" wrote in message ... Hello Account Numbers are in B3 Can someone help me with how to name a sheet with IF B3 = V014989 Then SheetName = 101 IF B3 = V015013 Then SheetName = 102 This is what i have which returns the Private Sub SheetName() On Error Resume Next ActiveSheet.Name = Range("B3") & Format(Now(), "[$-409] yy-mmm-d;@") If Err.Number < 0 Then MsgBox Err.Number & " -- " & Err.Description End If On Error GoTo 0 Thanks Mike |
Naming a sheet
Just add more ElseIf statements
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Mike" wrote in message ... Bet what if I need to add more later "Bob Phillips" wrote: Is it just Private Sub SheetName() With ActiveSheet If .Range("B3").Value = " V014989" Then .Name = "101" ElseIf .Range("B3").Value = "V015013" Then .Name = "102" End If End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Mike" wrote in message ... Hello Account Numbers are in B3 Can someone help me with how to name a sheet with IF B3 = V014989 Then SheetName = 101 IF B3 = V015013 Then SheetName = 102 This is what i have which returns the Private Sub SheetName() On Error Resume Next ActiveSheet.Name = Range("B3") & Format(Now(), "[$-409] yy-mmm-d;@") If Err.Number < 0 Then MsgBox Err.Number & " -- " & Err.Description End If On Error GoTo 0 Thanks Mike |
All times are GMT +1. The time now is 08:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com