SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old July 26th, 2003, 02:16 AM
scottk scottk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 scottk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
excel, changing 2 sheet names by input on one tab?

Hi,

What I need to create is a pair of two sheets, that as they are copied and re-named the second sheet would be renamed by the first sheet's name with a prefix added.

So if there was a pair of sheets "sheet1" and "Psheet1", and they are copied at the same time and automatically renamed by excel to "sheet1 (2)" and "Psheet2 (2)" or the index of sheet(3) and sheet(4). The user could just rename the first “A” and the second would be renamed by the CONCATENATE function, adding P to the name of the first with resultant sheet name “PA”.

To complicate things, the users currently change the sheet name on the tab it-self, that name is inserted on a cell in the sheet by using the formula.

=MID(CELL("FileName",A1),FIND("]",(CELL("FileName",A1)))+1,999)

So there is actually no change on the work sheet to trigger the input. This is not a requirement but it would be nice that the only input would occur on the tab it self.


thanks,
Scott

Reply With Quote
  #2  
Old August 24th, 2003, 08:05 PM
levonau levonau is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: South Australia, Australia
Posts: 7 levonau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm not exactly sure what you are after but you can refer to this...

Open a new excel workbook.
Place an 'A' in cell A1.
Add two buttons and leave the macro name as Button1_click & Button2_click.
In the visual Basic editor paste the folowing...


Sub Button1_Click()
Sheets("Sheet1").Name = Range("a1").Text
Sheets("sheet2").Name = "P" + Range("a1").Text


End Sub

Sub Button2_Click()
Sheets(Range("a1").Value).Activate
ActiveSheet.Name = "Sheet1"
Sheets("p" + Range("a1")).Activate
ActiveSheet.Name = "Sheet2"
Sheets("Sheet1").Activate
Range("a1").Select
End Sub


Don't know if this helps..!

Levonau

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > excel, changing 2 sheet names by input on one tab?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway