Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro for drop down

Status
Not open for further replies.

Slippenos

MIS
Apr 22, 2005
333
US
I fire a macro when the drop down value below changes. Problem is, I don't know how to properly define the dropdown.

Code:
Sub DropDown61_Change()
    Dim Dropdown_1
    [red]Dropdown_1 = Worksheets(1).ListBox(1).Value[/red]
    If D61 = "25198047" Then
        Worksheets(1).Range("F18").Value = "X"
    End If
End Sub

Any thoughts?

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 

Hi,

If it's on your sheet...
Code:
  With Activesheet.shapes("DropDown61").oleformat.object.object
msgbox .text& " is the selected value"
  end with


Skip,

[glasses] [red]Be Advised![/red] A man's home is his castle...
in a Manor of speaking. [tongue]
 
SkipVought,

Thanks for responding. I manipulated your suggestion to this:
Code:
Sub DropDown61_Change()
    Dim Dd_1
    [purple]Dd_1 = ActiveSheet.Shapes("DropDown61").OLEFormat.Object[/purple]
    If Dd_1 = "25198047" Then
        Worksheets(1).Range("F18").Value = "X"
    End If
End Sub

I get this error:
"The item with the specified name was not found."

Any other suggestions?

Thanks.


[blue]Go to work to learn. Don't go to work to earn.[/blue]
 

When you SELECT that object on the sheet, what name is in the Name Box?

Skip,

[glasses] [red]Be Advised![/red] A man's home is his castle...
in a Manor of speaking. [tongue]
 
There is no name. I got the DropDown_61 from the Subprocedure Excel created for me.

If I right-click and go to Format Control, my only options are tabs: Size, Protection, Properties, Web, and Control.

Any thoughts?


[blue]Go to work to learn. Don't go to work to earn.[/blue]
 


Then you're using a Control Toolbox control
Code:
Sub DropDown61_Change()
    Dim Dd_1
    Dd_1 = DropDown61.text
    If Dd_1 = "25198047" Then
        Worksheets(1).Range("F18").Value = "X"
    End If
End Sub

Skip,

[glasses] [red]Be Advised![/red] A man's home is his castle...
in a Manor of speaking. [tongue]
 
I got a run-time error '424'. Object required.
[red]Dd_1 = DropDown61.Text[/red]

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 


Exactly how did your insert this object?

Where is this object located?

Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
I add a combo box from the fromat control toolbox. The object is located on top of the cells; not really part of the sheet.

I right-click on the control and I go to Format Control to select its values from some cells on another sheet.

[blue]Go to work to learn. Don't go to work to earn.[/blue]
 
I go to Format Control to select its values from some cells on another sheet
that sounds more like a Forms Toolbar object than a Control Toolbox object!?!?

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top