Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / June 2006

Tip: Looking for answers? Try searching our database.

Counters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
halem2 - 30 Jun 2006 21:37 GMT
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
halem2 - 30 Jun 2006 21:44 GMT
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

Signature

halem2

Thyagaraj - 30 Jun 2006 21:50 GMT
> Hi folks:
>
[quoted text clipped - 11 lines]
> halem2's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=9930
> View this thread: http://www.excelforum.com/showthread.php?threadid=557473

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
halem2 - 30 Jun 2006 21:59 GMT
thanks!!! I just got it working using

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

thanks a lot;) :cool:

Signature

halem2

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.