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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible to have a command button bring up a combo box 1

Status
Not open for further replies.

ftoddt

Technical User
Apr 26, 2003
180
US
I have a combox on a userform that its primary use is to use the drawdown bar to select an entry and then click a command button and it takes you to an excel page. I would like to create a command button that will first provide me with a input box to place a number in. After entering the number, I would like another popup box(like the input box) to pop up with the preexisting combobox and allow me to select and then enter one of the items in the combobox. That would then take the preexisting number entry to the page of the selected combobox selection.
I have not seen how to make an input box pop up from a command box that has a combo box with drawdown in it.
I am very very new at this so bear with me.
Thanks,
Todd
 
The InputBox command does just what you need:

Private Sub Command1_Click()
Dim strInput As String
strInput = InputBox("Enter a Value", "Input")
'Do what you need with the string here
End Sub


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
johnwm,
This is what I am kind of using as a second popup

Private Sub Command1_Click()
Dim Prompt, Purpose
Prompt = "Enter Debit Purpose"
Purpose = InputBox$(Prompt)
ActiveCell.Value = Purpose
End Sub
What I want to do is have a Input box come up that is in essence a combobox that I am already using on another page and let me select from that combo box the "Debit Purpose"
Is that what the code above that you provided will do.
Todd
 
It looks like you're in Excel VBA rather than VB and usually you will do better to post VBA questions in the VBA forum (forum707) rather than here in the VB5/6 forum. faq222-2244 gives some guidance on getting the best from these forums.

The easy way to do what you're after is to use your combobox and set it's Visible property to False. In your Command button click event:

Code:
Private Sub CommandButton1_Click()
ComboBox1.Visible = True
End Sub

and in your ComboBox:

Code:
Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
ComboBox1.Visible = False
End Sub

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 

Thanks Johnwm,
I am new at this and did not realize I could be in the wrong forum. You have given me lots to look at and I appreciate your time.
Thanks again,
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top