Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ra ra is offline
external usenet poster
 
Posts: 27
Default Name Sheet with Input Box and text

Hello,

I am trying to build a macro to add code to the front of the current
sheet name through an input box.

eg. enter F01 into box and all sheets change to F01_sheet1, F01_sheet2
etc.

I can get my code to rename based on input but how do I combine this
to existing sheet name?

Sub Namesheets()
'
Dim Dept_Code As String
Dept_Code = InputBox("Enter Dept Code (e.g. F01)")
'
Sheets("Weekly Sales Input Template").Select
Sheets("Weekly Sales Input Template").Name = Dept_Code

End Sub

Any help would be great
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Name Sheet with Input Box and text

Hi
Is this what you want?

Sheets("Weekly Sales Input Template").Name = Dept_Code & "_" &
Sheets("Weekly Sales Input Template").Name

If you need this in a loop for all sheets do

for each wks in Activeworkbook.Worksheets
wks.Name = Dept_Code & "_" & wks.name
next wks

regards
Paul

On Mar 6, 9:46*am, ra wrote:
Hello,

I am trying to build a macro to add code to the front of the current
sheet name through an input box.

eg. enter F01 into box and all sheets change to F01_sheet1, F01_sheet2
etc.

I can get my code to rename based on input but how do I combine this
to existing sheet name?

Sub Namesheets()
'
Dim Dept_Code As String
* Dept_Code = InputBox("Enter Dept Code (e.g. F01)")
'
* * Sheets("Weekly Sales Input Template").Select
* * Sheets("Weekly Sales Input Template").Name = Dept_Code

End Sub

Any help would be great


  #3   Report Post  
Posted to microsoft.public.excel.programming
ra ra is offline
external usenet poster
 
Posts: 27
Default Name Sheet with Input Box and text

On 6 Mar, 09:58, wrote:
Hi
Is this what you want?

Sheets("Weekly Sales Input Template").Name = Dept_Code & "_" &
Sheets("Weekly Sales Input Template").Name

If you need this in a loop for all sheets do

for each wks in Activeworkbook.Worksheets
* * wks.Name = Dept_Code & "_" & wks.name
next wks

regards
Paul

On Mar 6, 9:46*am, ra wrote:



Hello,


I am trying to build a macro to add code to the front of the current
sheet name through an input box.


eg. enter F01 into box and all sheets change to F01_sheet1, F01_sheet2
etc.


I can get my code to rename based on input but how do I combine this
to existing sheet name?


Sub Namesheets()
'
Dim Dept_Code As String
* Dept_Code = InputBox("Enter Dept Code (e.g. F01)")
'
* * Sheets("Weekly Sales Input Template").Select
* * Sheets("Weekly Sales Input Template").Name = Dept_Code


End Sub


Any help would be great- Hide quoted text -


- Show quoted text -


Thanks Paul, that work perfectly.
I have been trying something similar but kept getting an error
"Expected end of statment"... thanks again for your help.
Reply
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
assigning text box input to a sheet [email protected] Excel Programming 1 April 26th 07 07:17 AM
input # on sheet 1, pulls all info for # from sheet 2 moochx5 Setting up and Configuration of Excel 1 July 19th 06 10:43 AM
Copy my active sheet to a new sheet and open with an input form Brad Withrow Excel Programming 0 April 6th 06 03:56 AM
I want data on sheet 1 to input into sheet 2 also walott1 Excel Worksheet Functions 2 June 23rd 05 03:56 PM
How to input additional text to multiple of existing cells that has text [email protected] Excel Worksheet Functions 2 June 21st 05 01:46 AM


All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"