Hi
is there an Excel 365 VBA command to return the current page number of a sheet?
Regards
Hi
is there an Excel 365 VBA command to return the current page number of a sheet?
Regards
Do you mean the page of a selection in a print area or the index number of a worksheet?
Index number of a worksheet:
Please Login or Register to view this content.
If things don't change they stay the same
Assume I have a sheet with three pages. I want to display the sentence "Page 1 of 3" in the first page, "Page 2 of 3" in the second page, "Page 3 of 3 " in the third page. I do not want to use footer. I can count the total pages but how to assign the individual pages.
Assume I have a sheet with three pages. I want to display the sentence "Page 1 of 3" on the first page, "Page 2 of 3" on the second page, and "Page 3 of 3 " on the third page. I do not want to use the footer. I can count the total pages but how do assign the individual pages.
So you actually want a value on the sheet at the top of each page?
Is the range fixed, i.e. does each page have a set count of rows?
Has the range been set as a print area?
The Footer is the easiest way but it only shows when you print, I am guessing that is not what you are after:
Please Login or Register to view this content.
Yes, I want the value on the sheet put in cell (G7)
yes each page consists from 50 rows
yes, has the same print area (A3).
I am not sure what 'print area (A3)' means.
I assume that if the value is to start at G7 then it is more of a header than a footer.
If you have a print range set on the sheet then the below will add page numbers as a header to each page that consists of 50 rows.
Please Login or Register to view this content.
A3 paper size
there is more header, I set rows(1-11) to print as a title for each page. The "page # of #" is included within rows (1-11).
I will try this code.
shall the result of this code stored in the cell, for example, "G7"?
if some rows are hidden by code, does this code work perfectly?
Below is the initial concept of the macro when the rows can have different heights. The macro requires defining the print area manually or by code in advance. The numbering will be inserted in the top right cell of each page.ArtikPlease Login or Register to view this content.
Thx. for your reply
Can I send the file to you? I am a beginner in VBA and properly I will make many mistakes.
@Artik
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks