0

I am trying to populate a combobox drop down list when a different combobox "combobox2" is clicked. I am receiving the error Runt time error 438 Object doesnt support this property or method. I am also sources the listfillrange values from a seperate worksheet. I have included my code below.

Private Sub ComboBox2_Click()

     Dim N As Long

     N = Worksheets("Regions-Offices").Cells(1, 8).End(xlDown).Row

     ActiveSheet.Cells(1, 2).Value = N

     Worksheets("Global").OLEObjects("ComboBox3").Object.ListFillRange = Worksheets("Regions-Offices").Range("H1:" & N).Address

End Sub
6
  • 1
    You don't have the 2nd H in the range Commented Sep 24, 2019 at 21:00
  • Also, you can use offset from H1 instead of using N or offset N Commented Sep 24, 2019 at 21:00
  • @Nathan_Sav I changed the range to be Range("H1:" & "H" & N) however now i am getting error 438 Object doesnt support this property or method Commented Sep 24, 2019 at 21:05
  • range("h1:h" & n) I would have tried. Which line is the error on, just to be sure. There are some arguments to .address too Commented Sep 24, 2019 at 21:06
  • @Nathan_Sav the error is on the following line "Worksheets("Global").OLEObjects("ComboBox3").Object.ListFillRange = Worksheets("Regions-Offices").Range("H1:H" & N).Address". Also evenb with Address removed error 438 is still there Commented Sep 24, 2019 at 21:08

2 Answers 2

1

use External parameter of Address property:

Worksheets("Global").OLEObjects("ComboBox3").ListFillRange = Worksheets("Regions-Offices").Range("H1:H" & N).Address(, , , True)
Sign up to request clarification or add additional context in comments.

Comments

0

The worksheet name isn't evaluated in the return of address so

"'Regions-Offices'!H1:H" & N

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.