#1   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

I am trying to have a file print in legal size if I have 56 lines filled in
otherwise print in regular letter size. Does anyone know how to write this
in VBA. help would be appreciated. thanks
  #2   Report Post  
PY & Associates
 
Posts: n/a
Default PRINT IF in VBA

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines filled

in
otherwise print in regular letter size. Does anyone know how to write

this
in VBA. help would be appreciated. thanks



  #3   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

I copied it and placed it in the macro but I get a syntex error, what am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines filled

in
otherwise print in regular letter size. Does anyone know how to write

this
in VBA. help would be appreciated. thanks




  #4   Report Post  
PY & Associates
 
Posts: n/a
Default PRINT IF in VBA

You copied and pasted?
then you have not taught your computer how to count the row numbers yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error, what am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines

filled
in
otherwise print in regular letter size. Does anyone know how to write

this
in VBA. help would be appreciated. thanks






  #5   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row numbers yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error, what am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines

filled
in
otherwise print in regular letter size. Does anyone know how to write
this
in VBA. help would be appreciated. thanks








  #6   Report Post  
PY & Associates
 
Posts: n/a
Default PRINT IF in VBA

These two are only xlConstants for your information if you wish to change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row numbers yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error, what

am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines

filled
in
otherwise print in regular letter size. Does anyone know how to

write
this
in VBA. help would be appreciated. thanks








  #7   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

The number of rows changes hourly. Is there a way for the macro to count the
number of rows and then based on the number if 55 make it legal size.

"PY & Associates" wrote:

These two are only xlConstants for your information if you wish to change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row numbers yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error, what

am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56 lines
filled
in
otherwise print in regular letter size. Does anyone know how to

write
this
in VBA. help would be appreciated. thanks









  #8   Report Post  
PY & Associates
 
Posts: n/a
Default PRINT IF in VBA

Try this

LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row

"Curt D." wrote in message
...
The number of rows changes hourly. Is there a way for the macro to count

the
number of rows and then based on the number if 55 make it legal size.

"PY & Associates" wrote:

These two are only xlConstants for your information if you wish to

change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row numbers

yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error,

what
am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize =

xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56

lines
filled
in
otherwise print in regular letter size. Does anyone know how

to
write
this
in VBA. help would be appreciated. thanks











  #9   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

I put both of the tips in the macro but it still did not count the number of
rows with data and make it legal size if the nbr of rows are greater than 56.
LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
If Row - nr 46 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal


"PY & Associates" wrote:

Try this

LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row

"Curt D." wrote in message
...
The number of rows changes hourly. Is there a way for the macro to count

the
number of rows and then based on the number if 55 make it legal size.

"PY & Associates" wrote:

These two are only xlConstants for your information if you wish to

change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row numbers

yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex error,

what
am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize =

xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have 56

lines
filled
in
otherwise print in regular letter size. Does anyone know how

to
write
this
in VBA. help would be appreciated. thanks












  #10   Report Post  
PY & Associates
 
Posts: n/a
Default PRINT IF in VBA

change If Row - nr 46 to
if lastrow56

"Curt D." wrote in message
...
I put both of the tips in the macro but it still did not count the number

of
rows with data and make it legal size if the nbr of rows are greater than

56.
LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
If Row - nr 46 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal


"PY & Associates" wrote:

Try this

LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row

"Curt D." wrote in message
...
The number of rows changes hourly. Is there a way for the macro to

count
the
number of rows and then based on the number if 55 make it legal

size.

"PY & Associates" wrote:

These two are only xlConstants for your information if you wish to

change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your

print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row

numbers
yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex

error,
what
am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize =

xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have

56
lines
filled
in
otherwise print in regular letter size. Does anyone know

how
to
write
this
in VBA. help would be appreciated. thanks
















  #11   Report Post  
Curt D.
 
Posts: n/a
Default PRINT IF in VBA

that did it..yah ooh..thanks for all the help I really appreciate it.

"PY & Associates" wrote:

change If Row - nr 46 to
if lastrow56

"Curt D." wrote in message
...
I put both of the tips in the macro but it still did not count the number

of
rows with data and make it legal size if the nbr of rows are greater than

56.
LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
If Row - nr 46 Then ActiveSheet.PageSetup.PaperSize = xlPaperLegal


"PY & Associates" wrote:

Try this

LastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row

"Curt D." wrote in message
...
The number of rows changes hourly. Is there a way for the macro to

count
the
number of rows and then based on the number if 55 make it legal

size.

"PY & Associates" wrote:

These two are only xlConstants for your information if you wish to
change
the paper sizes. They should not remain in the code.

also how does the computer (and ourselves) know how many rows your

print
area have? When know, adjust row_nr to suit please.

"Curt D." wrote in message
...
I guess not. The syntex error shows up on the following.
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)


"PY & Associates" wrote:

You copied and pasted?
then you have not taught your computer how to count the row

numbers
yet.

"Curt D." wrote in message
...
I copied it and placed it in the macro but I get a syntex

error,
what
am i
doing wrong?

"PY & Associates" wrote:

If Row - nr 56 Then ActiveSheet.PageSetup.PaperSize =
xlPaperLegal
xlPaperLetter Letter (8-1/2 in. x 11 in.)
xlPaperA4 A4 (210 mm x 297 mm)

"Curt D." wrote in message
...
I am trying to have a file print in legal size if I have

56
lines
filled
in
otherwise print in regular letter size. Does anyone know

how
to
write
this
in VBA. help would be appreciated. thanks















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
My gridlines wont print. Even though i have gone thr print opts? Lemmy Excel Discussion (Misc queries) 1 September 14th 05 01:17 PM
How can I print current row in same place on paper but not print surrounding cells??? Andy Ford New Users to Excel 1 September 2nd 05 05:50 AM
One spreadsheet cell won't print but shows up in print preview? Sally Excel Discussion (Misc queries) 1 May 26th 05 07:06 PM
set the print area print multiple tabs veng Excel Discussion (Misc queries) 5 February 12th 05 07:01 PM
Printing - Have to set print area 1 column further than necessary STUART BISSET Excel Discussion (Misc queries) 0 January 24th 05 07:59 PM


All times are GMT +1. The time now is 01:03 PM.

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"