Macro to find bottom row and insert new row

FIRSTCHOICE

Board Regular
Joined
Dec 14, 2011
Messages
93
All,

I have a spreadsheet where I have a section where the user can input new information and the idea would be for the user to then click a button and the new information is added to bottom on the spreadsheet and then numbered it at the last item. I have the whole macro created but I cannot seem to figure out how to write a few lines that would tell the macro to find the bottom line and insert a new line and populate it with the data in the input cells. If anyone could help I would greatly appreciate it. If any additional information is needed please let me know, I am a little wary of posting the document because there is some sensitive information in it.

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
To locate the last row in col A

Dim LASTROW As Long

LASTROW = Cells(Rows.Count, 1).End(xlUp).Row
 
Upvote 0
Thanks!

Can I put that in the middle of a already recorded macro? Also, that selects the cell to insert would I just need to add

Selection.Insert Shift:=xlUp, CopyOrigin:=xlFormatFromLeftOrAbove
 
Upvote 0
Thank you for your help but this still isn't able to help my situation.

I need to find the last row and insert a row above and I would like to put this into an already recorded macro so I don't have to create the whole thing from scratch.

Steps
1) Find last row
2) Insert row above
 
Upvote 0
LASTROW = Cells(Rows.Count, 1).End(xlUp).Row
Rows(LASTROW).Select
Selection.Insert Shift:=xlUp, CopyOrigin:=xlFormatFromLeftOrAbove
 
Upvote 0
YES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:):):):)

THANK YOU! You have restored my colleagues confidence!
 
Upvote 0
SteveO59L Thank you so much!

I have run into 1 unforeseen issue. when my macro goes to copy the information it is still copying into the same cell and I need it to copy into the new cell that we inserted at the bottom. Is there a quick fix for this?

Thanks,
 
Upvote 0
I actually messed around with the vba a little and figured it out. But of course I ran into another issue. In Cell G:27 there is a fomrula that I want to copy down to the last row.

Selection.AutoFill Destination:=Range("G27:G28"), Type:=xlFillDefault
Range("G27:G28").Select

Could I do:

Selection.AutoFill Destination:=Range("G27:LastRow"), Type:=xlFillDefault
Range("G27:Lastrow").Select
 
Upvote 0

Forum statistics

Threads
1,215,360
Messages
6,124,493
Members
449,166
Latest member
hokjock

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