#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counters


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

--
halem
-----------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...nfo&userid=993
View this thread: http://www.excelforum.com/showthread.php?threadid=55747

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counters


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
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=557473

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Counters


halem2 wrote:
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


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counters


thanks!!! I just got it working using

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

thanks a lot;)


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=557473

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Counters Vic Excel Discussion (Misc queries) 5 April 5th 10 06:38 PM
Counters Paul Excel Worksheet Functions 2 February 11th 05 01:52 PM
Using for next with two counters Albert Jameson Excel Programming 1 October 15th 04 02:37 AM
Counters Terri[_5_] Excel Programming 2 September 27th 04 08:23 PM
counters tag Excel Programming 0 September 14th 03 12:48 AM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"