Prev Previous Post   Next Post Next
  #4   Report Post  
JohnUK
 
Posts: n/a
Default

Thanks to Bob Phillips and Jim May for their answers to
my last Post

I now need to go a step further - Once the names of the
tabs have been changed, I need a code that can reset the
tab names back to how they were. The problem I have is
that when I run the macro to change the names back, the
macro now doesn't recognise the new names and comes up
with an error message.

I guess it just needs a code that can jump to the next
tab regardless of what it's called - changes it - then
jumps to the next tab and so on.

The workbook has 40 sheets/Tabs, but I only need the
second half (20 sheets) to do its job

Thanks
John


-----Original Message-----
Hi John,

VBA event code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address(False, False) = "A1" Then
Me.Name = Target.Value
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

RP
(remove nothere from the email address if mailing direct)


"JohnUK" wrote in

message
...
Hi, I am looking for a code that can change the sheet

tab
name to correspond with a name in a given cell on the
same worksheet
Many thanks in advance
John



.

 
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
sorting names alphabetically when names may start with numbers John Smith Excel Discussion (Misc queries) 3 May 11th 05 08:06 PM
macro to change the names and delete closed books Tim Excel Discussion (Misc queries) 2 February 6th 05 09:39 PM
how can I count distinct names in an excel list? RPC@Frito Excel Discussion (Misc queries) 5 February 3rd 05 09:12 PM
Pull unique names for drop down list [email protected] Excel Discussion (Misc queries) 3 February 1st 05 10:23 PM
How can I find the common names in two columns of names? hako Excel Discussion (Misc queries) 2 December 8th 04 01:59 AM


All times are GMT +1. The time now is 04:08 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"