Macro that will find the next empty row in a table

Anon415

New Member
Joined
Nov 15, 2012
Messages
2
Hi...I am currently working on a budgeting project in MS Excel 2010 and need to copy data from one worksheet to the first available row on the main data worksheet. All of the data on the main worksheet is listed in a table. I have found a code that will take me to the first empty row, however the row it is locating is the first empty row after my table. I need the code to find either the first empty row in the table or the last populated row in the table. Unfortunately there are various blank cells throughout the table. This is what I currently have.


<code>Sub PostPrepaid()
' PostPrepaid Macro
' Post monthly payment amount of all active prepaid accounts to main Data worksheet
Sheets("Prepaid Data").Select
Range("A31:I42").Select
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst Sheets("DATA").Select Range("A65536").End(xlUp).Offset(1, 0).Select ActiveSheet.Paste
ActiveCell.Offset(9, 0).
Range("A1").Select
End Sub</code>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Welcome to MrExcel board...

put in a variable like this & replace the code after the copy

Code:
LR = Sheets("Data").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Data").Activate
Range("A" & LR).Select
ActiveSheet.Paste
 
Upvote 0
Unfortunately I am still getting the same results...the entries are posting to the first available row after the table...I am new to all of this, I hope I followed your directions correctly..this is the code I used

Sub PostPrepaid()
'
' PostPrepaid Macro
' Post monthly payment amount of all active prepaid accounts to data sheet
'

'
Sheets("Prepaid Data").Select
Range("A31:I42").Select
Selection.Copy
LR = Sheets("Data").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Data").Activate
Range("A" & LR).Select
ActiveSheet.Paste
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,071
Messages
6,128,619
Members
449,460
Latest member
jgharbawi

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