Evagrius Ponticus
Well-known Member
- Joined
- May 24, 2007
- Messages
- 1,467
Hi Gang,
Not sure what's wrong with my code. I am trying to add the sheet names in a workbook to a list box so users can select which sheet they would like to print from the listbox. But the problem is that I only want to include the visible sheets in the listbox. Thanks for any help.
Not sure what's wrong with my code. I am trying to add the sheet names in a workbook to a list box so users can select which sheet they would like to print from the listbox. But the problem is that I only want to include the visible sheets in the listbox. Thanks for any help.
Code:
Private Sub UserForm_activate()
Dim i As Integer
For i = 1 To Sheets.Count
If Sheets(i).Hidden = False Then
ListBox1.AddItem Sheets(i).Name
End If
Next i
End Sub