#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Worksheet Tab Name

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.



  #2   Report Post  
Posted to microsoft.public.excel.misc
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.





  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default Worksheet Tab Name

Thanks very much. It worked.

"Bob Phillips" wrote:

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.






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
Search one worksheet for values in another worksheet? ClayShooters Excel Discussion (Misc queries) 1 July 4th 06 03:01 PM
Worksheet not showing up in VBE Kevin Vaughn Excel Worksheet Functions 3 June 12th 06 03:22 PM
Inserting Filtered RC cell information into other worksheets Dennis Excel Discussion (Misc queries) 10 July 30th 05 01:54 AM
Search/Match between 2 x separate Worksheets and populate result in third worksheet Alan Bartley Excel Discussion (Misc queries) 1 April 11th 05 05:21 AM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM


All times are GMT +1. The time now is 05:15 PM.

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

About Us

"It's about Microsoft Excel"