Drop down list within VBA

Yoepy

New Member
Joined
Feb 22, 2015
Messages
44
Hi all, hope someone can assist.

I have a blank template which I add to the workbook as a new event is created.

I have now noticed there are three other circumstances which require different templates. So I will have Blank1, Blank2, Blank3 and Blank4 templates.

Currently i just have a piece of code which adds the new sheet (and then does a whole lot of other stuff).

Code:
Sheets("Blank1").Copy After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = "Sheet" & ActiveSheet.Index

How do I get a selection box to pop up when I run the "NewSheet" macro which asks "Which template do you want to add?" and then adds the appropriate blank?

Thanks in advance.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try this code
Code:
Sub Macro1()


Sheets(InputBox("Enter Sheet Name:", "SHEET NAME")).Copy After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = "Sheet" & ActiveSheet.Index
    
    End Sub
 
Upvote 0
Thanks, but I don't want to type the choice. I must be able to use a drop down or data validation list
user-offline.png
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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