dummyquestion Posted October 25, 2017 Report Posted October 25, 2017 help kavali in MICROSOFT VBA (Visual Basic for Applications) ? OR telesena contacts vunna chepande.I can pay for it.Thanks Quote
dummyquestion Posted October 25, 2017 Author Report Posted October 25, 2017 Hi, I have a workbook with a macro which generates 147+ pages. i would like to have first page, last page and rest of the pages different. my footer should give the count of rows printed till the current page. I am also breaking pages such as each page has 35 rows in it. Below is the code i tried. issue is i am not getting different footer for different page. any other code ayena parle . Thanks in advance. this is the code.. Sheets("Preview").Select FirstDataRow = 15 RowsPerPage = 35 headrow = FirstDataRow - 1 FinalRow = Cells(Rows.Count, 1).End(xlUp).Row 'counting total number of pages PageCount = (FinalRow - headrow) / RowsPerPage PageCount = Application.WorksheetFunction.RoundUp(PageCount, 0) 'resetting page breaks like 35 lines per page Set xWs = Sheets("Preview") Set findRow = Sheets("Preview").Range("A:A").Find(What:="VIN", LookIn:=xlValues) findRowNumber = findRow.Row + 2 xRow = 35 xWs.ResetAllPageBreaks xLastrow = xWs.Range("A" & Rows.Count).End(xlUp).Row For i = xRow + findRowNumber To xLastrow Step xRow xWs.HPageBreaks.Add Before:=xWs.Cells(i, 1) 'different footer value calculation and different footer for each page. j = j + 1 TotaltillthisPage = 7 * j 'different footer value calculation and different footer for last page. If j = PageCount Then Totallastpage = (FinalRow - FirstDataRow) / 5 Application.PrintCommunication = False With ActiveSheet.PageSetup .CenterFooter = "&""Arial,Bold""&12Total Number of Repairs for Model Year 2017 = " & Format(Totallastpage, "#,##0") & vbNewLine & "Total Number of Repairs to this point= " & Format(TotaltillthisPage, "#,##0") & vbNewLine & " Page: &P of &N" End With Exit For End If 'different footer value calculation and different footer for each page. Application.PrintCommunication = False With ActiveSheet.PageSetup .CenterFooter = "&""Arial,Bold""&12Total Number of Repairs to this point= " & Format(TotaltillthisPage, "#,##0") & vbNewLine & " Page: &P of &N" End With Next i Quote
chicchara Posted October 25, 2017 Report Posted October 25, 2017 https://www.mrexcel.com/forum/excel-questions/784128-vba-add-page-number-footer-excel.html https://stackoverflow.com/questions/5904967/excel-vba-to-print-the-date-and-page-number-in-the-header-and-footer https://excel.tips.net/T003135_Page_Numbers_in_VBA.html https://msdn.microsoft.com/en-us/vba/excel-vba/articles/formatting-and-vba-codes-for-headers-and-footers Quote
dummyquestion Posted October 25, 2017 Author Report Posted October 25, 2017 morning posted in few of them no response... Quote
TampaChinnodu Posted October 25, 2017 Report Posted October 25, 2017 VBA still using aa janaalu Quote
dakumangalsingh Posted October 25, 2017 Report Posted October 25, 2017 11 minutes ago, TampaChinnodu said: VBA still using aa janaalu Yeah maa company lo konni prod servers lo VBA scripts toh jobs run chestaru. Quote
alooparata Posted October 25, 2017 Report Posted October 25, 2017 45 minutes ago, TampaChinnodu said: VBA still using aa janaalu yes for QA testing Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.