I have a userform with fields that uses a range on Sheet1. The listbox on the userform refers to a range on another sheet (Sheet2). I know if the listbox referred to data on Sheet1 I could use the following code with no issues.
[VBA]
Dim rTable As Range
Set rTable = Range(Cells(1, "AA"), Cells(1, "AV").End(xlDown))
Set rTable = rTable.Resize(rTable.Rows.Count - 1).Offset(1)
lstEmpList.RowSource = rTable.Address[/VBA]
When the range is on another worksheet I learned I have to use a string instead. My dilema is I need to mirror the use of xlDown and the offset references I used in the code above. Can anyone show me how to modify the following code to look like the code above.
[VBA]
Dim MyStr As String
MyStr = "frmAdmin!AJ1:AM2"
lstEmpList.RowSource = MyStr
[/VBA]
I originally tried to get this code to work but I had no success.
[VBA]
Dim rng As Range
Set rng = Worksheets("frmAdmin").Range("DocInfo").End(xlDown).Value
lstEmpList.RowSource = rng.Resize(rng.Rows.Count - 1).Offset(1).Address
[/VBA]