Combobox autocomplete

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,834
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I came across this thread and it seems to work if the list is on the same worksheet as the combobox:

Can someone please tell me how to amend it if the list is on a different sheet?

I tried changing this part of the code:

Code:
Private Sub ComboBox1_DropButtonClick()
    With Me.ComboBox1
        .List = Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp)).Value ' CHANGING THIS LINE CAUSES PROGRAM TO CRASH
        .ListRows = Application.WorksheetFunction.Min(6, .ListCount)
        .DropDown
    End With
End Sub

but I get a permission error message.

Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I came across this thread and it seems to work if the list is on the same worksheet as the combobox:

Can someone please tell me how to amend it if the list is on a different sheet?

I tried changing this part of the code:

Code:
Private Sub ComboBox1_DropButtonClick()
    With Me.ComboBox1
        .List = Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp)).Value ' CHANGING THIS LINE CAUSES PROGRAM TO CRASH
        .ListRows = Application.WorksheetFunction.Min(6, .ListCount)
        .DropDown
    End With
End Sub

but I get a permission error message.

Thanks
Not sure why it didn't work before but it does now.
 
Upvote 0
You didn't post an answer that solved the question, so there is no need to mark your last post as the solution. Perhaps someone else who had the same problem night explain the reason.
 
Upvote 0

Forum statistics

Threads
1,215,634
Messages
6,125,931
Members
449,274
Latest member
mrcsbenson

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