Solved

Excel 2010 VBA Sheet Rename

Posted on 2014-04-06
3
553 Views
Last Modified: 2014-04-06
I am using Excel 2010 VBA with the following variable to get information from a text box for input into a spreadsheet:
    MyProject = SBINumberTextBox.Text
I have no problem with this task.

I also want to use this variable to rename the current (active) sheet.  During the renaming process, I want to start with some static text followed by the variable text.

"SBI(space)" + MyProject

So if the user enters 888 into the text box, the end result should be that the sheet is now titled SBI 888.

Is it possible to use information from a text box in this fashion?

Thanks for your expertise,

Bill
0
Comment
Question by:cowboywm
  • 2
3 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 39981852
I am sure it is possible.

Another question which rises in my mind is: Why do you write this long question with all the explanations instead of simple test of ONE line of VBA code?
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 39981861
OK, you may write:

ActiveSheet.Name = "SBI " + MyProject

or

Sheets(1).Name = "SBI " + MyProject

etc.

Remember some characters are not allowed in sheet names.

Restricted characters are  / \ * ? [ ]
Following characters could also be problematic in some cases  !@#$%&()+~`"':;,.|
And the sheet name length is also restricted in Excel...
0
 

Author Comment

by:cowboywm
ID: 39982068
I'll give this a try.  The reason I try to be specific is that things get lost in the writing translation.  Since there is on dialog I choose to be as clear a possible to avoid these back an forth emails.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This collection of functions covers all the normal rounding methods of just about any numeric value.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now