LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default create worksheet with specific name

Hi, is this what you need?
1) this sub will be called when user select something in the ComboBox
2) the value is parsed, separated by "-"
3) active sheet is the PLAN sheet: move it to the first
4) name the rest of sheets by month name
5) also put month name to cell [A1] in corresponding sheet
If full name is needed (i.e. April instead of apr), can add simple
translation routine to do it.

Private Sub ComboBox1_Change()
Dim strQTR As String

strQTR = ComboBox1.Value
ActiveSheet.Move befo=Worksheets(1) ' move PLAN as 1st sheet
Worksheets(2).Name = Split(strQTR, "-")(0) ' 1st month
Worksheets(3).Name = Split(strQTR, "-")(1) ' 2nd month
Worksheets(4).Name = Split(strQTR, "-")(2) ' 3rd month
Worksheets(2).[A1] = Worksheets(2).Name ' cell [A1] has the name
Worksheets(3).[A1] = Worksheets(3).Name
Worksheets(4).[A1] = Worksheets(4).Name
End Sub

--AC


"Joel" wrote:

MonthSelected = combobox1.Value

For Each sht In Sheets
If UCase(sht.Name) < "PLAN" Then

'test if there is a dash in sht names
If InStr(MonthSelected, "-") 0 Then
Mnth = Left(MonthSelected, _
InStr(MonthSelected, "-") - 1)
sht.Name = Mnth
MonthSelected = Mid(MonthSelected, _
InStr(MonthSelected, "-") + 1)
Else
sht.Name = MonthSelected
Exit For
End If
End If
Next sht


"Vladimir" wrote:

The workbook has already 4 worksheets: Plan and 3 reports.
In the first worksheet (plan) with a toolbox combobox the user will choose 1
of 4 options:
Jan-feb-march
apr-may-june
july-aug-sept
oct-nov-dec

when 1 of 4 options is choosen automatically other 3 worksheets shoud
receive respective names: say apr, may, june and in a cell of each worksheet
should appear April, May or June correspondingly.

 
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
Create a Link to a Specific Worksheet mlenmik Excel Discussion (Misc queries) 2 June 16th 09 04:32 PM
Create a new worksheet with a macro and giving it a specific name Steve Krieger Excel Discussion (Misc queries) 2 May 27th 09 10:18 PM
How do you create a menu for just that specific worksheet? gregesau Excel Discussion (Misc queries) 1 January 1st 07 01:18 AM
Navigate to specific cell on specific worksheet Bryan Excel Programming 2 April 13th 06 04:33 PM
create named range specific to worksheet [email protected] Excel Programming 2 June 28th 05 04:38 PM


All times are GMT +1. The time now is 07:56 PM.

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

About Us

"It's about Microsoft Excel"