![]() |
Get cell's print sheet #
I there any way (work around or direct function) to get
the page number that a given cell will print on? Help is appreciated! |
Get cell's print sheet #
Here is a macro, I think by Ron de Bruin, that will put page of page in the
active cell, will that help? Sub pagenumber() 'will not update automatically 'will put page of page in the active cell Dim VPC As Integer, HPC As Integer Dim VPB As VPageBreak, HPB As HPageBreak Dim NumPage As Integer If ActiveSheet.PageSetup.Order = xlDownThenOver Then HPC = ActiveSheet.HPageBreaks.Count + 1 VPC = 1 Else VPC = ActiveSheet.VPageBreaks.Count + 1 HPC = 1 End If NumPage = 1 For Each VPB In ActiveSheet.VPageBreaks If VPB.Location.Column ActiveCell.Column Then Exit For NumPage = NumPage + HPC Next VPB For Each HPB In ActiveSheet.HPageBreaks If HPB.Location.Row ActiveCell.Row Then Exit For NumPage = NumPage + VPC Next HPB ActiveCell = "Page " & NumPage & " of " & _ Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 2003 ** remove news from my email address to reply by email ** "Wandering Mage" wrote in message ... I there any way (work around or direct function) to get the page number that a given cell will print on? Help is appreciated! |
Get cell's print sheet #
I think that I will be able to use this, yes. Thank you
very much for the help! -----Original Message----- Here is a macro, I think by Ron de Bruin, that will put page of page in the active cell, will that help? Sub pagenumber() 'will not update automatically 'will put page of page in the active cell Dim VPC As Integer, HPC As Integer Dim VPB As VPageBreak, HPB As HPageBreak Dim NumPage As Integer If ActiveSheet.PageSetup.Order = xlDownThenOver Then HPC = ActiveSheet.HPageBreaks.Count + 1 VPC = 1 Else VPC = ActiveSheet.VPageBreaks.Count + 1 HPC = 1 End If NumPage = 1 For Each VPB In ActiveSheet.VPageBreaks If VPB.Location.Column ActiveCell.Column Then Exit For NumPage = NumPage + HPC Next VPB For Each HPB In ActiveSheet.HPageBreaks If HPB.Location.Row ActiveCell.Row Then Exit For NumPage = NumPage + VPC Next HPB ActiveCell = "Page " & NumPage & " of " & _ Application.ExecuteExcel4Macro("GET.DOCUMENT(50)" ) End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 2003 ** remove news from my email address to reply by email ** "Wandering Mage" wrote in message ... I there any way (work around or direct function) to get the page number that a given cell will print on? Help is appreciated! . |
All times are GMT +1. The time now is 09:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com