Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping question | Excel Discussion (Misc queries) | |||
Not Looping | Excel Discussion (Misc queries) | |||
Looping | Excel Discussion (Misc queries) | |||
for Looping in VBA/Form | Excel Discussion (Misc queries) | |||
Looping through textboxes | Excel Discussion (Misc queries) |