View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Pass parameter to a form and then open it?

Darren,

Here is an example of some code that loads a form combobox from a worksheet
range, and then selects an item based jupon a value in B1.

Load UserForm1
With UserForm1
.ComboBox1.RowSource = Range("A1:A10").Address(False, False)
.ComboBox1.ListIndex = Range("B1").Value
.Show
End With

Post back if you need further explanation .

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Darren Hill" wrote in message
...
[Excel 2000]
Is there a combobox-style Inputbox hidden away in Excel anywhere? Or is it
possible to pass parameters to a form as it loads?

I have a macro, which in the middle of the code requires input from the
user.
Presents a form with a combobox on it.
The combobox is filled with a list - lets call it MyList.
Based on the value of a variable in the macro (call it MyValue), a
specific entry in the list is already selected.
The user then either accepts the offered value or selects a different
value from the list.
The macro then stores the result in a variable (MyResult) and

continues
the code.

I don't want to use a standard inputbox because many of the entries

are
long strings, and it will be irritating to type them in.
But using a form is complicated by the need to pass the default list
entry to the form.

I hope I've explained my problem clearly - can anyone suggest a solution?

Darren