LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

It worked for me when I added a combobox from the control toolbox toolbar to a
worksheet named Sheet1.

I did rename the combobox from ComboBox1 to cmblist.

So is there a worksheet named Sheet1 that holds a combobox from the control
toolbox toolbar named cmblist in your workbook?



Kiran wrote:

Hi Dave,
Thanks for your reply. Appreciate it. But your code did not work. I got the
following error:
"Run time error: 438
Object does not support this method or property. "
When debugged stops at this line:
Worksheets("Sheet1").cmblist.AddItem RoomName

All I have on that excel sheet is a combo box. And On "Column I" on Sheet1 I
have a bunch of room names (bed room, great room, kitchen) and want to load
this list onto the combo-box when my customer opens the excel spreadsheet.

Can u help?
thnx

"Dave Peterson" wrote:

My bet is that it's a typo.

Worksheets("Sheets1").cmbList.AddItem (roomName)

Is the worksheet really named SheetS1 (with that extra S near the end)?

And I'd be hesitant to use a variable named Item. It's used in VBA, too. And
it may not confuse excel, but it sure can confuse me. (I also don't like single
character variables--but that's a personal preference.) And I like declaring my
variables, too.



Option Explicit
Sub testme01()

Dim myStr As String
Dim iCtr As Long
Dim RoomName As String

For iCtr = 1 To 6
myStr = "I" & iCtr
RoomName = Worksheets("Sheet1").Range(myStr).Value
Worksheets("Sheet1").cmblist.AddItem RoomName
'MsgBox RoomName
Next iCtr

End Sub


Kiran wrote:

For I = 1 To 6
Dim Item As String
Item = "I" & CStr(I)

roomName = Worksheets("Sheet1").Range(Item).Value
Worksheets("Sheets1").cmbList.AddItem (roomName)
MsgBox (roomName)
Next

I dont know why this piece of code is throwsing the error. If the line
Worksheets("Sheets1").cmbList.AddItem (roomName) is commented out, then the
msg box shows all the 6 items there. Which tells me there is some problem
with this line of code(combo box). Is there a property that needs to be set
for combo box's?Please help... Thnx


--

Dave Peterson


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a range of an array in a SUMPRODUCT formula gives a #N/A error Chrism Excel Discussion (Misc queries) 4 May 4th 05 04:06 PM
loop trough e-mail address list to send task lists with outlook Paul. Excel Discussion (Misc queries) 2 April 14th 05 11:48 AM
LOOP - Adddress List -to email Paul. Excel Discussion (Misc queries) 0 April 13th 05 09:54 AM
sum a range of cells that include an error HeatherC Excel Discussion (Misc queries) 2 January 28th 05 10:58 AM
dynamic combo boxes tjb Excel Worksheet Functions 2 January 25th 05 07:33 PM


All times are GMT +1. The time now is 12:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"