ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find last row and column for 1st page only (https://www.excelbanter.com/excel-programming/445113-find-last-row-column-1st-page-only.html)

geniusideas

Find last row and column for 1st page only
 
Hi,

I need urgently to find last row and last column for 1st page in
printing using VBA. In my case when I print this worksheet it consist
multiple pages. The problem now I need to know for page one (1st page)
what is the last row and also column.
Could someone here can help.
Please...

James Ravenswood

Find last row and column for 1st page only
 
On Nov 12, 2:32*am, geniusideas wrote:
Hi,

I need urgently to find last row and last column for 1st page in
printing using VBA. In my case when I print this worksheet it consist
multiple pages. The problem now I need to know for page one (1st page)
what is the last row and also column.
Could someone here can help.
Please...


See:

http://groups.google.com/group/micro...3df557cae2a8d2


Don Guillett[_2_]

Find last row and column for 1st page only
 
On Nov 12, 6:12*am, James Ravenswood
wrote:
On Nov 12, 2:32*am, geniusideas wrote:

Hi,


I need urgently to find last row and last column for 1st page in
printing using VBA. In my case when I print this worksheet it consist
multiple pages. The problem now I need to know for page one (1st page)
what is the last row and also column.
Could someone here can help.
Please...


See:

http://groups.google.com/group/micro...rogramming/bro...


You need a way for excel to help you find it such as a key word or row
number.
Send your file with a complete explanation and before/after examples
to dguillett1 @gmail.com


geniusideas

Find last row and column for 1st page only
 
Dear Sir,

I just want to know how many rows and columns in 1st page of printing?
That it..
How to count rows and column in HpageBreaks or VPageBreaks for page 1
only..
Thanks anyway..

geniusideas

Find last row and column for 1st page only
 
Thank you guys.. Finally I found the answer as below..

Sub FndFirstPageRowAndColumn()
Dim Col As Integer
Dim LstCol As Integer
Dim LstColPg
Dim LstRowPg
LstColPg = ActiveSheet.VPageBreaks(1).Location.Column - 1
LstRowPg = ActiveSheet.HPageBreaks(1).Location.Row - 1
MsgBox "Column" & "= " & LstColPg & Chr(10) & "Row" & "= " & LstRowPg
End Sub

Thanks anyway..

geniusideas

Find last row and column for 1st page only
 
Thanks Guys..

I Found the answer as below..
Sub FndFirstPageRowAndColumn()
Dim iHBreaks As Integer, iVBreaks As Integer
Dim LstColPg
Dim LstRowPg
iHBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count
If iVBreaks 1 Then
LstColPg = ActiveSheet.VPageBreaks(1).Location.Column - 1
Else
LstColPg = ActiveCell.SpecialCells(xlCellTypeLastCell).Column
End If
If iHpBreaks 1 Then
LstRowPg = ActiveSheet.HPageBreaks(1).Location.Row - 1
Else
LstRowPg = ActiveCell.SpecialCells(xlCellTypeLastCell).Row
End If
MsgBox "Column" & "= " & LstColPg & Chr(10) & "Row" & "= " & LstRowPg
End Sub

Thanks anyways..

Jim[_80_]

Find last row and column for 1st page only
 
via Google I saw this link
http://www.mrexcel.com/archive/VBA/19134.html
Looks very clever, not sure I understand it but could be a starting point


Jim


"geniusideas" wrote in message
...

Hi,

I need urgently to find last row and last column for 1st page in
printing using VBA. In my case when I print this worksheet it consist
multiple pages. The problem now I need to know for page one (1st page)
what is the last row and also column.
Could someone here can help.
Please...



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com