How do I create a worksheet using a drop down list?
Hi guys,
Is there any way to create a worksheet using a drop down list? For example, if I had a drop down list consisting of M and B, selecting one of the two values would create a worksheet with the name M with preassigned formulae and values in the sheet? Thanks |
How do I create a worksheet using a drop down list?
The easiest way would be to prepare the 2 worksheets and hide them. Then
attach a simple unhide macro to your drop down list. If you really want to create all sheet contents on-the-fly you would have to take additional precautions so that another selection from your drop down list doesn't overwrite an already existing sheet M with a fresh version. Joerg "TodiHawk" wrote in message ... Hi guys, Is there any way to create a worksheet using a drop down list? For example, if I had a drop down list consisting of M and B, selecting one of the two values would create a worksheet with the name M with preassigned formulae and values in the sheet? Thanks |
How do I create a worksheet using a drop down list?
Try this, assuming the DV is in cell H1
Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "H1" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Worksheets.Add.Name = .Value End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "TodiHawk" wrote in message ... Hi guys, Is there any way to create a worksheet using a drop down list? For example, if I had a drop down list consisting of M and B, selecting one of the two values would create a worksheet with the name M with preassigned formulae and values in the sheet? Thanks |
All times are GMT +1. The time now is 09:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com