Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a handful of montly invoices, where the line items increase / decrease
the amount of rows I may have from month to month. The client wants us to have Invoice Number and the Date at the bottom of the page. I have it setup that G48 has Invoice Number and H48 has a date formula, justified so it shows "Invoice # - Date" We want our logo image below that, so I have that setup as a footer. Excel is finicky with image footers, so having the Invoice # & Date in the footer does not play nice with the logo. I'm just trying to think of a macro that I could run either manually or on save / exit that would move those 2 cells to the last row of the worksheet. We use A4 paper. I hope this enough information & thanks for the assistance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This might help. It will tell you what the last row is, then you can simply
copy the data from the current place to the new place: Function iLastRowFilledInColumn(ws As Excel.Worksheet, iColumn As Long) As Long Dim iLastRow As Long iLastRow = ws.Cells(ws.Rows.Count, iColumn).End(xlUp).Row ' ' If the entire column is empty, Excel still returns 1 even though ' there is no data in row 1. Therefore, check to see if the ' cell is empty; if it is, return 0 instead of 1. ' If iLastRow = 1& Then If Trim(ws.Cells(iLastRow, iColumn)) = "" Then iLastRow = 0& End If End If iLastRowFilledInColumn = iLastRow End Function "Jennifer" wrote: I have a handful of montly invoices, where the line items increase / decrease the amount of rows I may have from month to month. The client wants us to have Invoice Number and the Date at the bottom of the page. I have it setup that G48 has Invoice Number and H48 has a date formula, justified so it shows "Invoice # - Date" We want our logo image below that, so I have that setup as a footer. Excel is finicky with image footers, so having the Invoice # & Date in the footer does not play nice with the logo. I'm just trying to think of a macro that I could run either manually or on save / exit that would move those 2 cells to the last row of the worksheet. We use A4 paper. I hope this enough information & thanks for the assistance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
SixSigmaGuy,
Thank you for the response. That is a good solution to a more complex problem, but doesn't really save anymore time (maybe a little) than just using the Page Break Preview and inserting or deleting the amount of rows that places it at the end of the end of the worksheet. I was just hoping to take it one step further, if possible. Mostly because I forget to go back to look at it before print, then have to reprint (the little tree-hugger inside hates that). Jennifer "SixSigmaGuy" wrote: This might help. It will tell you what the last row is, then you can simply copy the data from the current place to the new place: Function iLastRowFilledInColumn(ws As Excel.Worksheet, iColumn As Long) As Long Dim iLastRow As Long iLastRow = ws.Cells(ws.Rows.Count, iColumn).End(xlUp).Row ' ' If the entire column is empty, Excel still returns 1 even though ' there is no data in row 1. Therefore, check to see if the ' cell is empty; if it is, return 0 instead of 1. ' If iLastRow = 1& Then If Trim(ws.Cells(iLastRow, iColumn)) = "" Then iLastRow = 0& End If End If iLastRowFilledInColumn = iLastRow End Function "Jennifer" wrote: I have a handful of montly invoices, where the line items increase / decrease the amount of rows I may have from month to month. The client wants us to have Invoice Number and the Date at the bottom of the page. I have it setup that G48 has Invoice Number and H48 has a date formula, justified so it shows "Invoice # - Date" We want our logo image below that, so I have that setup as a footer. Excel is finicky with image footers, so having the Invoice # & Date in the footer does not play nice with the logo. I'm just trying to think of a macro that I could run either manually or on save / exit that would move those 2 cells to the last row of the worksheet. We use A4 paper. I hope this enough information & thanks for the assistance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If row 2 contains nothing then move onto next macro....... | Excel Programming | |||
Macro to move row from one worksheet to another | Excel Discussion (Misc queries) | |||
Move data from tab to tab using a macro | Excel Programming | |||
Macro to Move cells | Excel Programming | |||
Macro to Move cells | Excel Programming |