Combo Boxes

Phil C

Board Regular
Joined
Apr 10, 2002
Messages
64
Does anyone know how to get a combo box to look up values in a certain sheet.
I have tried the following code:
Private Sub UserForm_Initialize()
rownumber = [A65536].End(xlUp).Row
rownumber = rownumber + 1
Dim wscell As Range
For Each wscell In Range("Client Details!A1:A25")
cboDetails.AddItem (wscell.Value)
Next
txtDate.SetFocus
End Sub



The sheet name is the Client Details. When I remove this reference the combobox works fine.

Thanks in advance
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
It may not work due to lack of single quotes around your spreadsheet name. This is necessary when you have a space in the name. Try:
For Each wscell In Range("'Client Details'!A1:A25")

That is a double quote, then single quote, then Client Details, then single quote and etc
This message was edited by Fryer Tuck on 2002-05-06 11:15
This message was edited by Fryer Tuck on 2002-05-06 11:16
This message was edited by Fryer Tuck on 2002-05-06 11:18
 
Upvote 0
Thanks Fryer Tuck. Once I added the extra quote the problem was solved.

Cpod I could not get your code to work.
But thanks anyway
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top