Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default MACRO in a Loop Problem

Dear Anybody.

Consider this code:

Sub Macro41()
' Print ALL

Dim counter As Integer
For counter = 1 To 5
Call Over
Call Macro(counter)
Call Last
Next counter

End Sub

A few problems-
1. I want to address Macro1, Macro2, Macro3 €¦ but it it gives me an error on
the Call Macro line. How can I make it work?
2. I want the number 5 (final value of the loop) to be the contents of C2
cell of the current sheet and file the Macro41 is in.


Thanks in Advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default MACRO in a Loop Problem

Thanks.
I used the following, and the loop worked fine.


Sub Macro41()

' Print ALL
Dim x As Integer
For x = 1 To 5
Call Over7A
Application.Run ("Macro" & x)
Call Last7A
Next x

End Sub

But still I have this problem of the number 5 (the final value of the loop).
I want the number 5 to be the contents of cell C2 of the current sheet of a
file named €˜Name List.xls.


"Nigel" wrote:


Use this, substitute your macro number for x

Application.Run ("Macro" & x)


--

Regards,
Nigel




"Berj" wrote in message
...
Dear Anybody.

Consider this code:

Sub Macro41()
' Print ALL

Dim counter As Integer
For counter = 1 To 5
Call Over
Call Macro(counter)
Call Last
Next counter

End Sub

A few problems-
1. I want to address Macro1, Macro2, Macro3 €¦ but it it gives me an error
on
the Call Macro line. How can I make it work?
2. I want the number 5 (final value of the loop) to be the contents of C2
cell of the current sheet and file the Macro41 is in.


Thanks in Advance.


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
Loop Within a Loop Problem [email protected] Excel Programming 3 December 5th 07 01:23 PM
Macro loop problem Ben Excel Programming 4 June 27th 07 11:47 PM
Macro - Loop/automatization problem Eirik Sævareid Excel Programming 1 January 20th 07 10:19 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
Problem with loop Brad Excel Programming 2 May 3rd 05 07:13 PM


All times are GMT +1. The time now is 08:49 AM.

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"