Counters

  • Thread starter Thread starter halem2
  • Start date Start date
H

halem2

Hi folks:

I have some code I need to run let's say 10 times on the same sheet.
How can I use counters s I don't have to retype the code 10 times?

Also, how can I go to the following sheet to the right after the cod
executes the 10th time on that sheet?

thanks:confused
 
ok I figured out the Counter

for i = 1 to 10
code here
next i


Now how can I go to the next work sheet, assuming I have 150
worksheets?

thanks
 
halem2 said:
Hi folks:

I have some code I need to run let's say 10 times on the same sheet.
How can I use counters s I don't have to retype the code 10 times?

Also, how can I go to the following sheet to the right after the code
executes the 10th time on that sheet?

thanks:confused:

Dear Halem2,

You can use the following code :-

Sub Repeat1()
Dim N
N = 1
Do Until N = 10
'enter the code which needs to be repeated
N = N + 1
Loop
'Next sheet Selection
ActiveSheet.Next.Select
End Sub



Regards
Thyagaraj Shetty C.N
Bangalore
 
thanks!!! I just got it working using

For Each SH In ActiveWorkbook.Worksheets
SH.Activate
my code
Next

thanks a lot;) :cool:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top