Hi Jess,
You can use this function of Laurent Longre
to find to which page number belongs a cell
of a worksheet
Copy this function in a general module
'-------------------------------------------
Sub test()
MsgBox NumeroPage(Range("G25"))
End Sub
'-------------------------------------------
'--------------------------------------------
Function NumeroPage(Cellule As Range) As Integer
Dim VPC As Integer, HPC As Integer
Dim VPB As VPageBreak, HPB As HPageBreak
Dim Wksht As Worksheet
Dim Col As Integer, Ligne As Long
Set Wksht = Cellule.Worksheet
Ligne = Cellule.Row
Col = Cellule.Column
If Wksht.PageSetup.Order = xlDownThenOver Then
HPC = Wksht.HPageBreaks.Count + 1
VPC = 1
Else
VPC = Wksht.VPageBreaks.Count + 1
HPC = 1
End If
NumeroPage = 1
For Each VPB In Wksht.VPageBreaks
If VPB.Location.Column > Col Then Exit For
NumeroPage = NumeroPage + HPC
Next VPB
For Each HPB In Wksht.HPageBreaks
If HPB.Location.Row > Ligne Then Exit For
NumeroPage = NumeroPage + VPC
Next HPB
End Function
'---------------------------------------------
"Jess" <
[email protected]> a écrit dans le message de groupe de discussion :
(e-mail address removed)...
The Page break preview mode shows the area occupied by each page in an excel
worksheet. How can I programmatically know the page number for a given cell?