Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default macro only prints out first and last line of document

I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default macro only prints out first and last line of document

Do you mean this ?

If you fill in 3 it will print the sheet three times with another date
Delete "preview:=True" if it is working corect



Sub PrintCopies_ActiveSheet()
Dim CopiesCount As Long
Dim CopieNumber As Long

Range("I1").Value = "1/1/2004"

CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)

For CopieNumber = 1 To CopiesCount
ActiveSheet.PrintOut preview:=True
Range("I1").Value = Range("I1").Value + 1
Next CopieNumber

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default macro only prints out first and last line of document

you need the following line
Selection.PrintOut Copies:=1, Collate:=True
after each
Application.Goto Reference:="Print_Area"

"lschuh" wrote:

I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default macro only prints out first and last line of document

I figured that out by recording a macro (cheat) and inputting Jan 1, 04 - Jan
31, 04. When looking at the code of the macro i saw what the problem was.
Now I have a new problem. I have 31 dates for January 2004. They are
written as follows
ActiveCell.FormulaR1C1 = "1/1/2004"

I want to replace all the "1" with "2" to run the macro for the next month.
Where do I find the syntax to replace this or does it need another macro to
do it. Additionally I would have liked to have something like a start date
and an end date which would have performed the same actions with many fewer
lines. I did not know how to write that. I did see pieces of several codes
but did not know how to adapt my needs to it.

"justahelper" wrote:

you need the following line
Selection.PrintOut Copies:=1, Collate:=True
after each
Application.Goto Reference:="Print_Area"

"lschuh" wrote:

I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default macro only prints out first and last line of document

no I just need 1 copy printed from each day in the entire year. The
spreadsheet has been set up to insert a date into cell I1. This has to be
done for each day separately. Bummer. What I wanted originally was to do
this with some vba code or a macro that would either let me insert the start
date and the macro would run, print a page, then goto cell I1 and change the
date to the next day of the month and would run until it reached an ending
date. I cheated with a macro and like my answer to justahelper had to input
all 31 days manually. Now I don't know a way to replace the "1/1/2004" to
do the month of February, and so on. Any help is appreciated.

"Ron de Bruin" wrote:

Do you mean this ?

If you fill in 3 it will print the sheet three times with another date
Delete "preview:=True" if it is working corect



Sub PrintCopies_ActiveSheet()
Dim CopiesCount As Long
Dim CopieNumber As Long

Range("I1").Value = "1/1/2004"

CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)

For CopieNumber = 1 To CopiesCount
ActiveSheet.PrintOut preview:=True
Range("I1").Value = Range("I1").Value + 1
Next CopieNumber

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default macro only prints out first and last line of document

Have you try the macro ?

If you enter 30 it will print 30 pages with in the first
1/1/2004 the seconf 1/2/2004.....

--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
no I just need 1 copy printed from each day in the entire year. The
spreadsheet has been set up to insert a date into cell I1. This has to be
done for each day separately. Bummer. What I wanted originally was to do
this with some vba code or a macro that would either let me insert the start
date and the macro would run, print a page, then goto cell I1 and change the
date to the next day of the month and would run until it reached an ending
date. I cheated with a macro and like my answer to justahelper had to input
all 31 days manually. Now I don't know a way to replace the "1/1/2004" to
do the month of February, and so on. Any help is appreciated.

"Ron de Bruin" wrote:

Do you mean this ?

If you fill in 3 it will print the sheet three times with another date
Delete "preview:=True" if it is working corect



Sub PrintCopies_ActiveSheet()
Dim CopiesCount As Long
Dim CopieNumber As Long

Range("I1").Value = "1/1/2004"

CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)

For CopieNumber = 1 To CopiesCount
ActiveSheet.PrintOut preview:=True
Range("I1").Value = Range("I1").Value + 1
Next CopieNumber

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default macro only prints out first and last line of document

I need to replace January (1) with February (2)
To use another macro how would that work with what I already have?

"Ron de Bruin" wrote:

Have you try the macro ?

If you enter 30 it will print 30 pages with in the first
1/1/2004 the seconf 1/2/2004.....

--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
no I just need 1 copy printed from each day in the entire year. The
spreadsheet has been set up to insert a date into cell I1. This has to be
done for each day separately. Bummer. What I wanted originally was to do
this with some vba code or a macro that would either let me insert the start
date and the macro would run, print a page, then goto cell I1 and change the
date to the next day of the month and would run until it reached an ending
date. I cheated with a macro and like my answer to justahelper had to input
all 31 days manually. Now I don't know a way to replace the "1/1/2004" to
do the month of February, and so on. Any help is appreciated.

"Ron de Bruin" wrote:

Do you mean this ?

If you fill in 3 it will print the sheet three times with another date
Delete "preview:=True" if it is working corect



Sub PrintCopies_ActiveSheet()
Dim CopiesCount As Long
Dim CopieNumber As Long

Range("I1").Value = "1/1/2004"

CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)

For CopieNumber = 1 To CopiesCount
ActiveSheet.PrintOut preview:=True
Range("I1").Value = Range("I1").Value + 1
Next CopieNumber

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default macro only prints out first and last line of document

Please explain exactly what you want to do


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I need to replace January (1) with February (2)
To use another macro how would that work with what I already have?

"Ron de Bruin" wrote:

Have you try the macro ?

If you enter 30 it will print 30 pages with in the first
1/1/2004 the seconf 1/2/2004.....

--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
no I just need 1 copy printed from each day in the entire year. The
spreadsheet has been set up to insert a date into cell I1. This has to be
done for each day separately. Bummer. What I wanted originally was to do
this with some vba code or a macro that would either let me insert the start
date and the macro would run, print a page, then goto cell I1 and change the
date to the next day of the month and would run until it reached an ending
date. I cheated with a macro and like my answer to justahelper had to input
all 31 days manually. Now I don't know a way to replace the "1/1/2004" to
do the month of February, and so on. Any help is appreciated.

"Ron de Bruin" wrote:

Do you mean this ?

If you fill in 3 it will print the sheet three times with another date
Delete "preview:=True" if it is working corect



Sub PrintCopies_ActiveSheet()
Dim CopiesCount As Long
Dim CopieNumber As Long

Range("I1").Value = "1/1/2004"

CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)

For CopieNumber = 1 To CopiesCount
ActiveSheet.PrintOut preview:=True
Range("I1").Value = Range("I1").Value + 1
Next CopieNumber

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"lschuh" wrote in message ...
I can't get a reply to incrementing dates so I manually wrote a macro that
would start with Jan 1 2004 then print, go to the next line of code Jan 2
2004 then print. I tried to add lines in between for dates Jan 3, Jan 4,
etc. What is printing out is the first select and the last select. What is
wrong with it. *I ' the lines out to see the code run but does not print out
with the 'references removed

Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/1/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Selection.PrintOut Copies:=1, Collate:=True
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/2/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
Range("I1:J1").Select
ActiveCell.FormulaR1C1 = "1/3/2004"
Range("I2").Select
Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/4/2004"
'Range("I2").Select
'Application.Goto Reference:="Print_Area"
'Range("I1:J1").Select
'ActiveCell.FormulaR1C1 = "1/5/2004"
'Range("I2").Select
Application.Goto Reference:="Print_Area"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub









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
Excel Changes/Prints Document Differently & it also Locks some Cel Frank Excel Discussion (Misc queries) 2 February 2nd 09 10:30 PM
Is there a way to default the number times a document prints? Bat Excel Discussion (Misc queries) 1 August 24th 08 07:57 AM
In an excel document the info n row 2 prints out on both pages? He 2goode2btru Excel Discussion (Misc queries) 1 July 9th 06 05:06 PM
A 2 line text showing up in the Cell in Excel prints in 1 line Danny Excel Discussion (Misc queries) 6 July 12th 05 08:47 PM
document prints shifted to the right like it is right justified. gedgoudasl Excel Discussion (Misc queries) 0 March 4th 05 08:37 PM


All times are GMT +1. The time now is 05:34 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"