excel file, Sheet1 has 17 pages in total. Except for page 3, the remaining pages have data. How do I use the vba code to find the result of the page number containing 16 pages of data. Thank you all. Wish one good day
excel file, Sheet1 has 17 pages in total. Except for page 3, the remaining pages have data. How do I use the vba code to find the result of the page number containing 16 pages of data. Thank you all. Wish one good day
Maybe :
Please Login or Register to view this content.
1. I care dog
2. I am a loop maniac
3. Forum rules link : Click here
3.33. Don't forget to mark the thread as solved, this is important
Amazing my friend. You are a legend
I just use CountA instead of Count
Please Login or Register to view this content.
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
No, in fact, you are the legend Yasser, the correct way is using counta as your suggestion.
@minhys1 : please change using counta, as suggested by Yasser.
karedog, YasserKhalil. You both are so excellent. The results are exactly as I wanted. Thank you very much
Do not know, is it possible to expand in other cases as well:
* Case 2: the total number of pages without data of all the sheets in the open excel file
* Case 3: The total number of sheets without data of the specified sheet in the open excel file is entered by the user (any sheet or more than 2 sheets).
* Case 4: the total number of pages without data of all sheets (or Sheet specified by the user) in the excel file is not open, need to indicate the path and file name to be specifically checked.
* Case 5: I can't think of anything else next
You are welcome and thanks for the rep.point.
The core of my code is the "Function GetPageArea(sht As Worksheet)", we put a sheet as its parameter, and the function will return an array of page ranges divided by horizontal break. Then using counta for each range in this array we can determine if the current page is empty or not.
So for your other cases, you just call this function several times, and then totaling all the results.
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks