Solved

Excel 2010 VBA Sheet Rename

Posted on 2014-04-06
3
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

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 42

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 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