Hi Experts,
I have a macro enabled workbook and when I start the program I get "Run-time error 380 - could not set the rowsource property. Invalid property value" in my UserForm initialize. Line in error is when I set the rowsource below.
I am new to VBA. Please help.
Thanks in advance.
I have a macro enabled workbook and when I start the program I get "Run-time error 380 - could not set the rowsource property. Invalid property value" in my UserForm initialize. Line in error is when I set the rowsource below.
Code:
Private Sub UserForm_Initialize()
WorkbookName = ThisWorkbook.Name
Set wb = Workbooks(WorkbookName)
Set ws = wb.Worksheets("DOASaveAddtlCharges")
LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'set rowsource
If LastRow = 1 Then
ListBoxAddtlFees.RowSource = "DOASaveAddtlCharges!A2:C2"
Else
ListBoxAddtlFees.RowSource = "DOASaveAddtlCharges!A2:C" & LastRow
End If
End sub
I am new to VBA. Please help.
Thanks in advance.