ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveSheet.Next.Select not working! (https://www.excelbanter.com/excel-programming/285444-activesheet-next-select-not-working.html)

Ron McCormick[_2_]

ActiveSheet.Next.Select not working!
 
I have a procedure that goes through certain worksheets in
a number of workbooks and extracts data and then moves (or
is supposed to move) via a loop on to the next sheet using
the following code - 'ActiveSheet.Next.Select', the next
line of code being 'GoTo Resumeline'

The procedure works fine until it come to one particular
sheet at which point it jumps out of the loop to an error
handling routine, which keeps the procedure running on the
same sheet without going on to the next sheet, and thus
never getting out of the loop.

Anyone got any idea why this could be happening?

TIA
Ron

Chip Pearson

ActiveSheet.Next.Select not working!
 
Ron,

Are you sure you are not trying to get the next worksheet of the
last worksheet in the workbook?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ron McCormick" wrote in message
...
I have a procedure that goes through certain worksheets in
a number of workbooks and extracts data and then moves (or
is supposed to move) via a loop on to the next sheet using
the following code - 'ActiveSheet.Next.Select', the next
line of code being 'GoTo Resumeline'

The procedure works fine until it come to one particular
sheet at which point it jumps out of the loop to an error
handling routine, which keeps the procedure running on the
same sheet without going on to the next sheet, and thus
never getting out of the loop.

Anyone got any idea why this could be happening?

TIA
Ron




Ron McCormick[_3_]

ActiveSheet.Next.Select not working!
 
Thanks, Chip

No it wasn't the last worksheet. I found that a user had
left a stray bit of code on the next sheet that was
meaningless and consequentlly throwing the procedure into
the error routine.

Thanks for your suggestion.

Regards
Ron
-----Original Message-----
Ron,

Are you sure you are not trying to get the next worksheet

of the
last worksheet in the workbook?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ron McCormick" wrote in

message
...
I have a procedure that goes through certain worksheets

in
a number of workbooks and extracts data and then moves

(or
is supposed to move) via a loop on to the next sheet

using
the following code - 'ActiveSheet.Next.Select', the

next
line of code being 'GoTo Resumeline'

The procedure works fine until it come to one particular
sheet at which point it jumps out of the loop to an

error
handling routine, which keeps the procedure running on

the
same sheet without going on to the next sheet, and thus
never getting out of the loop.

Anyone got any idea why this could be happening?

TIA
Ron



.



All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com