Invalid use of property - excel VBA

Mahmoud Sayed

New Member
Joined
Sep 29, 2021
Messages
19
Office Version
  1. 2010
Platform
  1. Windows
VBA Code:
Sub listsource()
Dim Lr As Integer
Lr = sheet2.Range("B1000") .End(x1Up).Row
UserForm1.Listbox1.ColumnCount = 8
UserForm1.Listbox1.ColumnWidth = "120,80,80,80,90,70,65,70"

UserForm1.Listbox1.list -sheet2.Range("B2:I" & Lr).value

End Sub
 
Last edited by a moderator:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,

it´s not x1up but xlup, there´s an s missing at ColumnWidths, and I would usually run this as the UserForm_Initialize-Event.

Ciao,
Holger
 
Upvote 0
This line:

Code:
UserForm1.Listbox1.list -sheet2.Range("B2:I" & Lr).value

should be:

Code:
UserForm1.Listbox1.list = sheet2.Range("B2:I" & Lr).value
 
Upvote 0
Solution

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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