View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Brad Vontur Brad Vontur is offline
external usenet poster
 
Posts: 6
Default pagenumber of active cell (vba)

Ralf,

This would work if you don't have vertical page breaks..

Private Sub CommandButton1_Click()
Dim obj As Object
Dim intRow As Integer
Dim i As Integer
intRow = ActiveCell.Row
i = 1
For Each obj In ActiveSheet.HPageBreaks
If obj.Location.Row intRow Then
MsgBox i & " is the current page number."
Exit Sub
End If
i = i + 1
Next
End Sub

Hope that helps.

-Brad

-----Original Message-----
Hi,

how can i get the pagenumber of the selected cell?

thanks for any help
Ralf
merry christmas from germany!


.