Macro to copy and paste latest row into same row

joncarlan

New Member
Joined
Jan 15, 2018
Messages
3
Hi,

I currently have a running invoice log which has the following steps:
  • Paste booking confirmation into Paste tab
  • Invoice log looks up to relevant fields from paste tab to fill in log
  • Pro-forma tab looks up to the invoice log to make an invoice, which I save as a PDF.

The invoice log has the same formulas copied right the way down, and the only column I adjust is column A, the invoice number.

For example, column A is blank (I put in the invoice number which progress numerically). Column B is =today() Column C is =PASTE!$D$17 and so on (similar paste/trim functions). Essentially I'd like to add a button/macro which copy and pastes the row of the latest/highest number in column A, and paste specials this in the exact same row, removing the formulas, so my max formula from the pro-forma tab can pick up this information automatically.

Hope this makes sense, thanks in advance.

Jon.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Select your button from Developer|Insert|Form Controls|Command Button
A dialog box will appear with "Attach Macro" option. Click on the option to coplete the attchment.
Code:
Sub makeValue()
With Sheets("Invoice Log").Cells(Rows.Count, 1).End(xlUp).EntireRow
    .Value = .Value
End With
End Sub
After you have attached the macro to your button, if you click the button the macro will find the last invoice entry and change all cell content in that row to value only.
Be sure the sheet name "Invoice Log" is correct. If not, change it to be exactly as it appears on the sheet name tab.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,553
Messages
6,125,483
Members
449,233
Latest member
Deardevil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top