When you set up page number in Excel, most people would like to use Page setup, but have you ever thought of putting "nth page/Total M page" in any cell? Instead of just putting it in the header footer?
Method one, using VBA
Function page ()
page = (ActiveSheet.HPageBreaks.Count + 1) * (ActiveSheet.VPageBreaks.Count + 1)
Application.volatile
End Function
With VBA I only know the total number of methods, the current page number stumped me, but also please VBA master advice
Method Two, using the macro table function and the formula
1. First: Click ctrl+f3 to open the definition name, and then enter the "vertical page", in the following reference location, enter:
=if (MATCH (ROW (), GET, ISNA. DOCUMENT ()), 1,match (ROW (), get. DOCUMENT (64)) +1)
2. Then continue to add a second name: "Horizontal page", in the following reference location, enter:
=if (MATCH (column (), get. ISNA) DOCUMENT ()), 1,match (column (), get. DOCUMENT (65)) +1)
3. Enter the "Total page" and enter the reference position at:
=get. DOCUMENT (M) +rand () *0
4. Finally define "header", reference location:
= "&if" (horizontal as page =1, longitudinal page, horizontal as page + longitudinal page) & "page/Total" & Total Page & "page"
5. Use the application in the function bar to get the page number you need