Maraua
New Member
- Joined
- Mar 28, 2019
- Messages
- 4
Hi,
I have the following code that copies filtered data from one sheet to another. I use the copied data to populate a listbox on a userform:
I have been trying to adjust this to copy multiple, non-adjacent columns.
When I use
I have the following code that copies filtered data from one sheet to another. I use the copied data to populate a listbox on a userform:
Code:
With ws .AutoFilterMode = False
Set rng = ws.Range("B8:R8" & .Cells(Rows.Count, "B").End(xlUp).row)
rng.Copy ws1.Range("B7")
rngdest = "Sheet2!" & .Range("B8").CurrentRegion.Address
End With
With ListBox1
.RowSource = rngdest
.ColumnCount = 17
.ColumnWidths = "0;60;90;0;24;40;20;130;24;42;42;55;20;120;130;110;30"
End With
Set rng = Nothing
When I use
Code:
Set rng = ws.Range("B8:R" & ", T8:Z" & .Cells(Rows.Count, "B").End(xlUp).row)I get a runtime error 1004.
Any thoughts on how to accomplish this?
Thanks.