#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
naming sheet tab artist4christ Excel Worksheet Functions 5 January 17th 07 11:54 PM
Naming Sheet mehare Excel Discussion (Misc queries) 4 August 14th 06 06:20 PM
Naming a newly inserted sheet using VBA Ant Excel Discussion (Misc queries) 2 October 5th 05 01:55 PM
Workbook "Sheet" Naming comotoman Excel Discussion (Misc queries) 4 September 30th 05 09:49 PM
Naming & renaming a sheet tab Cgbilliar Excel Worksheet Functions 1 November 7th 04 05:57 PM


All times are GMT +1. The time now is 07:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"