Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       Sub WorksheetLoop()
  2.  
  3.          Dim WS_Count As Integer
  4.          Dim I As Integer
  5.  
  6.          ' Set WS_Count equal to the number of worksheets in the active
  7.         ' workbook.
  8.         WS_Count = ActiveWorkbook.Worksheets.Count
  9.  
  10.          ' Begin the loop.
  11.         For I = 3 To WS_Count
  12.  
  13.             ' Insert your code here.
  14.            ' The following line shows how to reference a sheet within
  15.            ' the loop by displaying the worksheet name in a dialog box.
  16.            MsgBox ActiveWorkbook.Worksheets(I).Name
  17.  
  18.          Next I
  19.  
  20.       End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement