How to move from 1 sheet to another using macros

  • Thread starter Thread starter Krishna
  • Start date Start date
K

Krishna

I have a certain number of sheets in my workbook. I read a
parameter from the 1st line of each sheet and based on its
value I either continue processing that sheet or move to
the next sheet in the workbook. What is the macro for
moving from 1 sheet to another within a workbook?
 
Krishna wrote...
. . . What is the macro for moving from 1 sheet to another
within a workbook?

Either something like

ActiveWorkbook.Worksheets(x).Activate

where x is either the index or name of the worksheet to which you wan
to move. If you want to move relative to the active worksheet
something like

ActiveWorkbook.Worksheets(ActiveSheet.Index + 1).Activate

or with error checking

If ActiveSheet.Index < ActiveWorkbook.Worksheets.Count Then _
ActiveWorkbook.Worksheets(ActiveSheet.Index + 1).Activat
 
Back
Top