hi
I have this code to show dat in listbox a based on active sheet.
I try showing data in list box throught all sheets but so far not work
any help to fix it ?
I have this code to show dat in listbox a based on active sheet.
VBA Code:
Private Sub UserForm_Initialize()
MyRowSource = "A2:d" & Str(activesheet.Cells.SpecialCells(xlCellTypeLastCell).Row)
MyRowSource = Replace(MyRowSource, " ", "")
ListBox1.RowSource = MyRowSource
Next
End Sub
I try showing data in list box throught all sheets but so far not work
Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
MyRowSource = "A2:d" & Str(ws.Cells.SpecialCells(xlCellTypeLastCell).Row)
MyRowSource = Replace(MyRowSource, " ", "")
ListBox1.RowSource = MyRowSource
Next
End Sub