Can a ComboBox display a Range in a hidden column?

AndyEd

Board Regular
Joined
May 13, 2020
Messages
124
Office Version
  1. 365
Platform
  1. Windows
I have the below code

VBA Code:
Me.cboSelectReferenceNumber.List = .Range("B2:B" & .Cells(.Rows.Count, "B").End(xlUp).Row).value

If I hide Column B, it displays the data within Column C instead. Will it not 'see' the hidden Column?

Thank you
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
When I fully qualify the range references, it works for me when I hide column B.
(I'm assuming this is a worksheet activeX combo box, not a userform combo box)

VBA Code:
Me.cboSelectReferenceNumber.List = Me.Range("B2:B" & Me.Cells(Me.Rows.Count, "B").End(xlUp).Row).Value
 
Upvote 0
VBA Code:
    With ThisWorkbook.Worksheets("LoanRates")
       Me.cboSelectReferenceNumber.List = .Range("B2:B" & .Cells(.Rows.count, "B").End(xlUp).Row).Value
    End With

It still works normally with a User form combobox. Using a fully qualified worksheet name, data is still loaded from column B, even when hidden. I'm sure you have your reasons for spooning out information one gram at a time, but I'm out. Good luck to you.
 
Upvote 1
Solution
I reworked the Worksheet and ended up looking up from a different list. This time it worked, so I can only assume I must have mistyped something.

Your method does indeed work.

As for 'spooning out' information, I'm not sure I get you? Sometimes I find it difficult to know what's relevant and not, so I see it more of an oversight...

Thanks for your time anyway.
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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