Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Find firse cell.address that will prin on page 3

How in vba do you find which cell will be on top left of page three if sheet
is printed.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Find firse cell.address that will prin on page 3

Hi Sunil,

Investigate the .Location property of items in both the VPageBreaks and
HPageBreaks collections. For example ...

debug.Print activesheet.vpagebreaks(1).location.address

will return something along the lines of: $I$1

Please carefully note that "Page 3" depends on worksheet/print area size and
whether you have set to print it "Down, then Over" or "Over, then Down".

I'm sure you'll be able to adapt it to your specific purpose from there. (If
not, post back).

HTH, Sean

"Sunil Patel" wrote:

How in vba do you find which cell will be on top left of page three if sheet
is printed.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Find firse cell.address that will prin on page 3

I have tried to insert this line (debug.Print
activesheet.vpagebreaks(1).location.address)
but i just get run time error 9 Subscript out of range.

Any ideas

"Sean Connolly" (DoNotSpam) wrote in
message ...
Hi Sunil,

Investigate the .Location property of items in both the VPageBreaks and
HPageBreaks collections. For example ...

debug.Print activesheet.vpagebreaks(1).location.address

will return something along the lines of: $I$1

Please carefully note that "Page 3" depends on worksheet/print area size
and
whether you have set to print it "Down, then Over" or "Over, then Down".

I'm sure you'll be able to adapt it to your specific purpose from there.
(If
not, post back).

HTH, Sean

"Sunil Patel" wrote:

How in vba do you find which cell will be on top left of page three if
sheet
is printed.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Find firse cell.address that will prin on page 3

Hi Sunil,

Then we've discovered one thing at least. You obviously don't have any
vertical page breaks in the relevant worksheet! i.e. Your worksheet (or print
area) is equal to or less than 1 page wide.

(A quick question that will help me as much as you. How many pages will your
worksheet print onto with the print settings that you have? - Tip: File menu
| Print Preview).

By any chance, did you then try to enter the following into the Immediate
Pane of the Visual Basic Editor (VBE) ...

debug.Print activesheet.hpagebreaks(1).location.address

Hit enter and, if your worksheet/print area exceeds 1 page (long), the
address of the 1st cell of the second page (down) will be returned.

(If it doesn't then you get the 'Subscript out of Range' error, because the
collection item that you're trying to refer to doesn't exist).

Hope that's clearer and helps and trust that you can go on from there.

Cheers, Sean.

"Sunil Patel" wrote:

I have tried to insert this line (debug.Print
activesheet.vpagebreaks(1).location.address)
but i just get run time error 9 Subscript out of range.

Any ideas

"Sean Connolly" (DoNotSpam) wrote in
message ...
Hi Sunil,

Investigate the .Location property of items in both the VPageBreaks and
HPageBreaks collections. For example ...

debug.Print activesheet.vpagebreaks(1).location.address

will return something along the lines of: $I$1

Please carefully note that "Page 3" depends on worksheet/print area size
and
whether you have set to print it "Down, then Over" or "Over, then Down".

I'm sure you'll be able to adapt it to your specific purpose from there.
(If
not, post back).

HTH, Sean

"Sunil Patel" wrote:

How in vba do you find which cell will be on top left of page three if
sheet
is printed.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Find firse cell.address that will prin on page 3

Hi Sunil,

Then we've discovered one thing at least. You obviously don't have any
vertical page breaks in the relevant worksheet! i.e. Your worksheet (or print
area) is equal to or less than 1 page wide.

(A quick question that will help me as much as you. How many pages will your
worksheet print onto with the print settings that you have? - Tip: File menu
| Print Preview).

By any chance, did you then try to enter the following into the Immediate
Pane of the Visual Basic Editor (VBE) ...

debug.Print activesheet.hpagebreaks(1).location.address

Hit enter and, if your worksheet/print area exceeds 1 page (long), the
address of the 1st cell of the second page (down) will be returned.

(If it doesn't then you get the 'Subscript out of Range' error, because the
collection item that you're trying to refer to doesn't exist).

Hope that's clearer and helps and trust that you can go on from there.

Cheers, Sean.

"Sunil Patel" wrote:

I have tried to insert this line (debug.Print
activesheet.vpagebreaks(1).location.address)
but i just get run time error 9 Subscript out of range.

Any ideas

"Sean Connolly" (DoNotSpam) wrote in
message ...
Hi Sunil,

Investigate the .Location property of items in both the VPageBreaks and
HPageBreaks collections. For example ...

debug.Print activesheet.vpagebreaks(1).location.address

will return something along the lines of: $I$1

Please carefully note that "Page 3" depends on worksheet/print area size
and
whether you have set to print it "Down, then Over" or "Over, then Down".

I'm sure you'll be able to adapt it to your specific purpose from there.
(If
not, post back).

HTH, Sean

"Sunil Patel" wrote:

How in vba do you find which cell will be on top left of page three if
sheet
is printed.








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
Coverting hyperlink cell to the web page address Roger on Excel Excel Discussion (Misc queries) 2 November 5th 07 08:20 PM
find last cell in range with data, display cell address sevi61 Excel Worksheet Functions 14 October 29th 07 08:36 PM
Is there a way to find the address of a cell with a certain value? Oshtruck user Excel Worksheet Functions 1 August 10th 06 07:57 PM
Why data in cell doesn't stay aligned with cell borders when prin. Danno Excel Discussion (Misc queries) 0 October 3rd 05 07:15 PM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM


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