Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Macro to move row to last row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro to move row to last row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Macro to move row to last row

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If row 2 contains nothing then move onto next macro....... [email protected][_2_] Excel Programming 2 June 12th 07 10:25 PM
Macro to move row from one worksheet to another Anders Excel Discussion (Misc queries) 2 October 25th 06 05:21 PM
Move data from tab to tab using a macro Sandybam Excel Programming 3 May 30th 06 10:29 PM
Macro to Move cells Weasel Excel Programming 2 September 4th 04 12:17 AM
Macro to Move cells Weasel Excel Programming 1 September 3rd 04 10:49 PM


All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"