![]() |
Using value from pulldown box in macro
Does anyone know if there is a way to use the value selected in a pulldown
box in a macro? I've already set up the pulldown box. Once that value has been selected, I want to use it in the following simple macro. If this is possible, how do I reference the selected value of the pulldown box? If anyone is aware of a good web resource that'd be useful, that'd be appreciated. I was unable to find a resource with regards to this when I searched. Thanks in advance for any assistance. k -- Sub CompileMfgBatteryList() Dim i As Integer, j As Integer Dim tempmodel As String i = 4 j = 2 Sheets("DataSheet").Activate Range("B2:B150").Delete ' I'd like to pull the name of the sheet from the pulldown box. ' Something like Sheets(valuefrompulldownbox).Activate Sheets("GNB").Activate Do Until IsEmpty(Cells(i, 2)) tempmodel = Cells(i, 2).Value i = i + 6 Sheets("DataSheet").Activate Cells(j, 2) = tempmodel j = j + 1 Sheets("GNB").Activate Loop End Sub k |
Using value from pulldown box in macro
Assuming your pulldown is on the same worksheet and you have given it
name and its from the control toolbar, it's as simple as this: Sheets(PullDown1.Text).Activate If you got it from the forms toolbar and are linking the selected valu to a cell, just use (assuming A1 is the cell link): Sheets(Range("A1")).Activate -- Message posted from http://www.ExcelForum.com |
Using value from pulldown box in macro
If you mean a data validation drop down list?
Then you can use this Sheets(Range("D3").Value).Select -- Regards Ron de Bruin http://www.rondebruin.nl "k" wrote in message ... Does anyone know if there is a way to use the value selected in a pulldown box in a macro? I've already set up the pulldown box. Once that value has been selected, I want to use it in the following simple macro. If this is possible, how do I reference the selected value of the pulldown box? If anyone is aware of a good web resource that'd be useful, that'd be appreciated. I was unable to find a resource with regards to this when I searched. Thanks in advance for any assistance. k -- Sub CompileMfgBatteryList() Dim i As Integer, j As Integer Dim tempmodel As String i = 4 j = 2 Sheets("DataSheet").Activate Range("B2:B150").Delete ' I'd like to pull the name of the sheet from the pulldown box. ' Something like Sheets(valuefrompulldownbox).Activate Sheets("GNB").Activate Do Until IsEmpty(Cells(i, 2)) tempmodel = Cells(i, 2).Value i = i + 6 Sheets("DataSheet").Activate Cells(j, 2) = tempmodel j = j + 1 Sheets("GNB").Activate Loop End Sub k |
All times are GMT +1. The time now is 11:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com