Problem in adding item to a checkbox

S

Shilps

I have a code

Dim i As Intege
r = Range("AR5000").End(xlUp).Ro
For i = 2 To
ComboBox3.AddItem CStr(Sheet1.Range("AR" + CStr(i)).Value
Nex

whenever I run, it gives runtime error 70: Permission denied
I want to add the entries in column AR to the dropdown list of the combobox. I cannot use listfillrange as the data will be lost when entries in AR change . AR stores the data resulting from a query
TI
Shilps
 
B

Bob Flanagan

I looks like you have not qualified the combobox. For example:

Userform1.ComboBox3.AddItem CStr(Sheet1.Range("AR" + CStr(i)).Value)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

Shilps said:
I have a code:

Dim i As Integer
r = Range("AR5000").End(xlUp).Row
For i = 2 To r
ComboBox3.AddItem CStr(Sheet1.Range("AR" + CStr(i)).Value)
Next

whenever I run, it gives runtime error 70: Permission denied.
I want to add the entries in column AR to the dropdown list of the
combobox. I cannot use listfillrange as the data will be lost when entries
in AR change . AR stores the data resulting from a query.
 
T

Tim Zych

Is ListFillRange being used? If so, ListFillRange and AddItem can't be used
simultaneously.


Shilps said:
I have a code:

Dim i As Integer
r = Range("AR5000").End(xlUp).Row
For i = 2 To r
ComboBox3.AddItem CStr(Sheet1.Range("AR" + CStr(i)).Value)
Next

whenever I run, it gives runtime error 70: Permission denied.
I want to add the entries in column AR to the dropdown list of the
combobox. I cannot use listfillrange as the data will be lost when entries
in AR change . AR stores the data resulting from a query.
 
S

Shilps

I am sorry Bob, but qualiifying the ComboBox didn't help:
I modified the code to
Dim i As Intege
r = Range("AR5000").End(xlUp).Ro
For i = 2 To
Worksheets("QUERY_BUILDER").ComboBox3.AddItem CStr(Sheet1.Range("AR" + CStr(i)).Value
Nex

But I am getting the same error.
 
Top