New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Change Multiple Sheets Names automatically based on cells

Macros, VBA, Excel Automation, etc.

Change Multiple Sheets Names automatically based on cells

Postby jshrtader » Sun Dec 18, 2011 2:54 am

I have a workbook with multiple sheet names with cryptic sheet names. In order to track how it is used each time, I will go to a central sheet ("Preferences" in the attached file) and type in the customer names in Column B. Even with this, I spend too much time constantly having to refer back to my Preferences worksheet.

Is there a way to have the entries in Column B automatically change from the entries defaulted in Column A? This would save a lot of time and make it more user friendly!

Thanks in advance for your insight!
  • 0

You do not have the required permissions to view the files attached to this post.
jshrtader
Rookie
 
Posts: 2
Joined: Dec 18, 2011
Reputation: 0

Re: Change Multiple Sheets Names automatically based on cell

Postby lucky027 » Sun Dec 18, 2011 11:24 am

could you try this code
It changes all sheets name and if you run it a second time that return the old name.
Hope that help you
Have a nice day... ;)

Code: Select all
Sub change_name_sheet()
Dim lastrow
lastrow = Range("A" & Rows.Count).End(xlUp).Row
If Sheets(2).Name = Range("A3") Then
For I = 2 To lastrow
Sheets("" & Range("A" & I) & "").Name = Range("B" & I)
Next
Else
For I = 3 To lastrow
Sheets("" & Range("B" & I) & "").Name = Range("A" & I)
Next
End If
End Sub
  • 0

lucky027
Rookie
 
Posts: 10
Joined: Dec 7, 2011
Reputation: 0

Re: Change Multiple Sheets Names automatically based on cell

Postby jshrtader » Sun Dec 18, 2011 12:44 pm

Thank you Luck027 for your fast reply!!!!

I am embarrassed to say that I am pretty good with basic and some advanced Excel functions, but I have never used Macros or VBA. Is the"code" that you refer to a Macro or VBA?

I apologize in advance that it will take me some time to learn how to make this work. Once I do, I will update the post and let you know if it worked!!!

:oops: :oops:
  • 0

jshrtader
Rookie
 
Posts: 2
Joined: Dec 18, 2011
Reputation: 0

Re: Change Multiple Sheets Names automatically based on cell

Postby charles » Sun Dec 18, 2011 2:20 pm

jshrtader,

Its VBA is an acronym for Excel and VB6 (stand alone and works with Excel and Access I think). Macro is just a name for the VBA code.
  • 0

There are other ways too do this but...

Be kind let us know if you posted somewhere else!



Charles
charles
Excel Badass
 
Posts: 632
Joined: Dec 10, 2011
Location: Mississippi
Reputation: 1
Excel Version: Excel 2003, 2007 and Mac 2011

Re: Change Multiple Sheets Names automatically based on cell

Postby lucky027 » Mon Dec 19, 2011 1:20 am

don't apologize, I try to explain you
VBA is a application to show the language basic with a editor in Excel (and more Microsoft applications)
You can find this editor when you type CTRL + F11 or in command bar TOOLS=>MACRO=> VIsual Basic Editor

You have a lot of possiblities to install the macro/code to make that you want
- in thisworbook, sheet, module code and class module code
You can use userform to show form to the user with code inside.

In my case the code that I provide you is a simple macro.
You can copy it in a module or this workbook code and run it with CTRL+F8 or create a button and assign the macro on it.

I hope that I'm clear in my purpose.
Sorry for my bad english I'm french and not a expert of this language.
Have a nice day ;)
  • 0

lucky027
Rookie
 
Posts: 10
Joined: Dec 7, 2011
Reputation: 0

Re: Change Multiple Sheets Names automatically based on cell

Postby Sisyphus » Sat Dec 31, 2011 7:50 am

Hi,

I wonder if you got lucky027's macro to work for you.
If not, I wonder if you really need to change the sheet names. You could create hyperlinks on your Preferences worksheet. When you click on the extended name the associated worksheet opens up - whatever its name. Wouldn't that save you even more time? :D

Happy New Year!
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 207 guests