View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Worksheet Tab Name

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ananth" wrote in message
...
Worksheet Tabe Name

In MS EXCEL, I am pulling in some records from Access Database.
using Import External Data feature. I am looking for a particular

country
and importing the data. The First Column contains the country.

Is there anyway, the SHEET NAME to get renamed automatically by looking at
Country name in Cell A1. If the country name is "Singapore", the worksheet
tab should get changed to Singapore.

When I import data next time into the same sheet for "Japan", the

worksheet
tab should change to "JAPAN" automatically.