AlanAnderson
Board Regular
- Joined
- Jun 7, 2010
- Messages
- 134
Hi,
I have a spreadsheet where not only can the amount of rows increase but so can the columns being used.
I need to reference parts of this area with a list box but am having difficulty in assigning cvariables to the rowsource.
My problem is that only the "1" from A1 is constant, the "A' would be supplied by a variable such as vStart whilst the "K" from last column and the 50 from Last Row.
Can this be done?
Regards,
Alan
I have a spreadsheet where not only can the amount of rows increase but so can the columns being used.
I need to reference parts of this area with a list box but am having difficulty in assigning cvariables to the rowsource.
Code:
Private Sub UserForm_Initialize()
Dim FinalRow As Long
Dim FinalCol As Long
With Me.ListBox1
.boundcolumn = 1
.columncount = FinalCol
.columnheads = True
.textcolumn = True
.rowsource = "A1:K50" 'Thats what it currently is
' .rowsource = vStart & 1 & ":" & FinalCol & FinalRow ' No form of this is working
.ListIndex = 0
End With
End Sub
Can this be done?
Regards,
Alan