Saturday 28 November 2015

Excel Page Breaks!




While developing a report in Excel .I faced a scenario which needs to count  the page breaks in excel sheet for that we have a method hpagebreaks.count

 pagebreak = Worksheets("Sheet1").HPageBreaks.count


By the above line we can get the count of the page breaks in sheet 1.


but the intention is to put the text in the above cell of each page break till the used range of the sheet.

so basically it took me arround 3 hours to crack the solutions for this I am  looping each cell in the column it is  processing properly,  till the first page break then it is throwing an error some times it is going to third page ,throwing error.

Then i understood the meaning of excel "perform exceptionally well" !
Logic ,it is processing up to the active cell means. Let us say if your pointer is placed in first column 9th row it will loop till the 9th row if there is any page break after it will shows the error message.

so we need to push the active cell beyond the used range

sheet2.Activate
ActiveWindow.ScrollRow = LastRow

the above two lines will activate the sheet 2 and pushes the active cell to last row which is nothing but the above used range we pass like 86.

For count = 1 To page break


brkr = sheet1.HPageBreaks(count).Location.Address  ' this will give the address of the page break
myvalue = sheet1.Range(replac).Value ' this will give the value in the cell
if myvalue ="" then

your logic hear............

else

your logic hear.......

end if 

Next count


this way you can achieve the task on page breaks in Excel!
finally what i understood is
                                           

Working on Excel needs more Excitement!


Further Reading on Excel 2013 







2 comments:

  1. russell robertson...
    There has been progress in herbal medicine of DR AKHIGBE which have become safer,in curing diseases;i was suffering and dying of herpes for past two years,untill i came across DR AKHIGBE on internet i email him on drrealakhigbe@gmail.com 'glory be to GOD'am cured of herpes by drinking his herbal medicine cure [HMC] he sent to me. Herbal medicine cure have made it possible curing diseases. i was once a victim and am giving out a living testimonies , and am been restore.
    So become easier to take or drink and where early herbal often required drinking it as frequently as 3 to 5 times per day, most first-line cured, herbal medicine now comprise a single daily fixed taking as the instruction followed. DR AKHIGBE also cure others diseases like ; HIV/AIDS,DIABETES,CANCER,HERPES,SYPHILLIS,MENINGITES,GENITAL AND SIMPLEX HERPES, ALS,HEPATITES A AND B.etc any one out there been effected by diseases to email drrealakhigbe@gmail.com or whatApp him on +2348142454860. GET YOUR HERBAL AND GET YOUR FREEDOM.

    ReplyDelete
  2. brothers and sister, let me use these opportunity to introduce a great doctor that cure ME FROM HIV/AIDS WITH HIS HERBAL MEDICINE. Dr Akhigbe, he is also know as the godfather of berbalism and all kind of root to cure different diseases.i meant his different testimonies on this blog site i also reach him through his email. first he encourage me with good advise, he told me to stop thinking on about the HIV and let my mind be free.secoundly he learnt me a short lesson that was very cleard to me and make me to understand that using condom when having sex is best protction. how ever,
    The period of HIV infection to develop in the body is about three to four weeks. This period can, however, be longer up to 3 months and in rare cases up to 6 months. Most people generally develop detectable HIV antibodies by current method within 3 months of infection or to 6 months before it expand to years.Dr Akhigbe feel for patienas as his own sons and daughters he sent my herbal medicine through UPS express delivery and it took me 5 working days before i received it, he also instruction me on on how to use it. he is a good caring doctor he must write me each day to know if am following up with the herbal merdicine for good three weeks before he later order me to go to hoapitle for another test and i get a surprise result, that was how i get my freedom from the hand of hiv/aids.Dr Akhigbe also use his herbal medicine to cure diseases like HERPES ,HIV/AIDS , DIABETES , CANCER , ALS etc for his help please reach him through his email drrealakhigbe@gmail.com or whatapp him +2348142454860

    ReplyDelete