Using value from pulldown box in macro

  • Thread starter Thread starter k
  • Start date Start date
K

k

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
 
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
 
If you mean a data validation drop down list?

Then you can use this
Sheets(Range("D3").Value).Select
 
Back
Top