List .rowsource property

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,132
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have mention below code, but .rowsource is not working.

I am trying to get the data from sheet which is veryhidden.

any Idea.



Private Sub CommandButton5_Click()
If Sheets("Show").Visible = xlSheetVeryHidden Then
With Me.ListBox1
.ColumnCount = 6
.ColumnWidths = "35;60;60;70;110;60"
.RowSource = Sheets("Show").Range("B12:H19").Address -----> Problem area, its not taking this rowsource.
.BorderStyle = fmBorderStyleSingle
.TextAlign = fmTextAlignLeft
.MultiSelect = fmMultiSelectMulti
End With
End If
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
RowSource takes a string:

Because that line says the RowSource should be the address of .RowSource = Sheets("Show").Range("B12:H19") then this can also be written as

Code:
[/COLOR][COLOR=#333333].RowSource = "B12:H19"[/COLOR][COLOR=#333333]

Which is wrong as this will use the active sheet. So you need to change the line to this:
Code:
.RowSource = "Show!B12:H19"
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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