Naming a sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 
Bet what if I need to add more later

Bob Phillips said:
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 said:
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
 
Just add more ElseIf statements

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



Mike said:
Bet what if I need to add more later

Bob Phillips said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top