Macro to create new sheets with combo box selection

fazan

New Member
Joined
Jun 25, 2008
Messages
2
Hi,

I have created a Combo Box to with a list of Work Sheet names, I need a macro to create a new shet with a standard format (copy an existing sheet) and name it as stated in the drop down list, if the sheet in not available in the file. If the sheet is available, go 2 that sheet (Hyper link)

Please help on this code.

Regards

Fazan
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Code:
Private Sub ComboBox1_Change()
Dim s1 As String: s1 = "Sheet2" 'sheet you wish to use as template for new sheets
On Error GoTo CreateNew
Sheets(ComboBox1.Value).Activate

Exit Sub

CreateNew:
Sheets(s1).Copy After:=Sheets(s1)
ActiveSheet.Name = ComboBox1.Value

End Sub
 
Upvote 0
Hi Lasw,

Thans for the quick reply its working well :). I ahve some problem,

1. In the combo box I want to restrict only the i have specified and should not allow excepting any other invalid entry.

2. further if there is alredy a selection in the combo box and i want to go to the same sheet its not working.

It it possible to change the combo box properties rectify the above or is ther any other option ?

Regards

Fazan
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top