#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Looping

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Looping

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Looping

TY Sean ... but it's not doing what i want, I'll to give more details....

The value in Cell N1 needs to change after every print.
Example:
My first print will have the value of 1 in cell N1, then macro command to
print page, then I automatically want the value in cell N1 to change to 2
then print, and so on until let's say page 30.

Does this make sense???

Maggie



--
MDP


"Sean Timmons" wrote:

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Looping

K.. so..

For i = 1 to 10
Range("N1").Value = i
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Next i


"Maggie" wrote:

TY Sean ... but it's not doing what i want, I'll to give more details....

The value in Cell N1 needs to change after every print.
Example:
My first print will have the value of 1 in cell N1, then macro command to
print page, then I automatically want the value in cell N1 to change to 2
then print, and so on until let's say page 30.

Does this make sense???

Maggie



--
MDP


"Sean Timmons" wrote:

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Looping

oh, and change the For i = 1 to 10 to whatever you want.. 1 to 30, say.

Or, you can do an input box to select # of pages, then do i = 1 to result.

"Maggie" wrote:

TY Sean ... but it's not doing what i want, I'll to give more details....

The value in Cell N1 needs to change after every print.
Example:
My first print will have the value of 1 in cell N1, then macro command to
print page, then I automatically want the value in cell N1 to change to 2
then print, and so on until let's say page 30.

Does this make sense???

Maggie



--
MDP


"Sean Timmons" wrote:

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Looping

That's great .. works like a charm.

Just another question on this .... do I need to make any changes to my macro
if there are several vlookup formulas in the worcheet that are linked to the
value of cell N1 and another datasource?
Would the print command in the macro activate only once all the formulas are
updated or do I need to add a special command in the macro?

--
MDP


"Sean Timmons" wrote:

oh, and change the For i = 1 to 10 to whatever you want.. 1 to 30, say.

Or, you can do an input box to select # of pages, then do i = 1 to result.

"Maggie" wrote:

TY Sean ... but it's not doing what i want, I'll to give more details....

The value in Cell N1 needs to change after every print.
Example:
My first print will have the value of 1 in cell N1, then macro command to
print page, then I automatically want the value in cell N1 to change to 2
then print, and so on until let's say page 30.

Does this make sense???

Maggie



--
MDP


"Sean Timmons" wrote:

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Looping

Good question. you can test for yourself by starting with i = 1 to 2 and see
what happens.

You can add a line item

Calculate prior to the print command.

"Maggie" wrote:

That's great .. works like a charm.

Just another question on this .... do I need to make any changes to my macro
if there are several vlookup formulas in the worcheet that are linked to the
value of cell N1 and another datasource?
Would the print command in the macro activate only once all the formulas are
updated or do I need to add a special command in the macro?

--
MDP


"Sean Timmons" wrote:

oh, and change the For i = 1 to 10 to whatever you want.. 1 to 30, say.

Or, you can do an input box to select # of pages, then do i = 1 to result.

"Maggie" wrote:

TY Sean ... but it's not doing what i want, I'll to give more details....

The value in Cell N1 needs to change after every print.
Example:
My first print will have the value of 1 in cell N1, then macro command to
print page, then I automatically want the value in cell N1 to change to 2
then print, and so on until let's say page 30.

Does this make sense???

Maggie



--
MDP


"Sean Timmons" wrote:

Depends on what you want to do with your loop. If you just want to do it 5
times regardless, you can do a couple things. Easiest would be change
printout copies:= to 5. :-)

If you want to change a value, say your "Value", then something like

For i = 1 to 10
ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select
"value" = "Value+1
Next i

Course, you may want to do other calculations, so it depends.

BTW, looks like your range.Select lines aren't needed.

"Maggie" wrote:

I need some help ....
How can I loop the following cammand

ActiveCell.FormulaR1C1 = "Value"
Range("N2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("N1").Select

--
MDP

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
Looping question Jase Excel Discussion (Misc queries) 2 March 19th 08 02:03 PM
Not Looping Roger Excel Discussion (Misc queries) 0 February 26th 08 05:18 PM
Looping David T Excel Discussion (Misc queries) 2 August 30th 06 10:51 PM
for Looping in VBA/Form Excel 2003 - SPB Excel Discussion (Misc queries) 4 July 24th 06 03:01 PM
Looping through textboxes CLamar Excel Discussion (Misc queries) 1 July 12th 06 04:33 PM


All times are GMT +1. The time now is 10:02 AM.

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

About Us

"It's about Microsoft Excel"