ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   .ListFillRange as Variable ? in Listbox (https://www.excelbanter.com/excel-programming/282453-listfillrange-variable-listbox.html)

[email protected]

.ListFillRange as Variable ? in Listbox
 
I am trying to create a Listbox and the ListFillRange is dependent
on what is in Sheet 2 Column 1. I am sure my mistake is something
simple but I cannot figure it out. Any help would be appreciated.

Lance



Sheets(2).Select
LastRow = Cells.Find("*", SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row

DropRange = "'Sheet2!A1:" & LastRow & "'"


Sheets(1).Select
ActiveSheet.ListBoxes.Add(780, 65, 125, 500).Select
With Selection
.ListFillRange = DropRange
.LinkedCell = ""
.MultiSelect = xlExtended
.Display3DShading = False
End With


Tom Ogilvy

.ListFillRange as Variable ? in Listbox
 
DropRange = "'Sheet2'!A1:A" & LastRow

--
Regards,
Tom Ogilvy


wrote in message
...
I am trying to create a Listbox and the ListFillRange is dependent
on what is in Sheet 2 Column 1. I am sure my mistake is something
simple but I cannot figure it out. Any help would be appreciated.

Lance



Sheets(2).Select
LastRow = Cells.Find("*", SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row

DropRange = "'Sheet2!A1:" & LastRow & "'"


Sheets(1).Select
ActiveSheet.ListBoxes.Add(780, 65, 125, 500).Select
With Selection
.ListFillRange = DropRange
.LinkedCell = ""
.MultiSelect = xlExtended
.Display3DShading = False
End With





All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com