View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steph Steph is offline
external usenet poster
 
Posts: 46
Default Loop without Do error

Hello. Can anyone figure out why I am getting a Loop without Do error with
the below code? I am trying to populate a listbox with ONLY visible sheets.
Thanks!

Private Sub Worksheet_Activate()
Dim intsheets As Integer
Dim ws As Worksheet

ListBox1.MultiSelect = fmMultiSelectMulti
ListBox1.Clear

intsheets = 1

Do While intsheets < (Sheets.Count + 1)
If ws.Visible = True Then
ListBox1.AddItem Worksheets(intsheets).Name
Else
intsheets = intsheets + 1
Loop
End Sub