Listbox rowsource on Userform
Dropping the .xls may break the code depending on a Windows setting for each
user. It's always safer to include the extension.
FSt1 wrote:
hi
your script out of range seems to occur on this line
Set ws = Workbooks("post.xls").Worksheets("data")
try changing it to....
Set ws = Workbooks("post").Worksheets("data")
ie without the .xls
Regards
FSt1
"Wendy" wrote:
Hi
I'm trying to set the rowsource of a listbox, I keep getting subscript out
of range error.
Thanks
Wendy
Private Sub UserForm_Initialize()
Dim LastRowNo As Long
Dim LastRow as String
Set ws = Workbooks("post.xls").Worksheets("data")
'find first empty row in sheet
LastRowNo = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
LastRow = "A2:C" & LastRowNo
Me.ListBox1.RowSource = LastRow
End Sub
--
Dave Peterson
|