Find last row in workbook sheet & move data to it from another sh

C

Chris Maddogz

I have two worksheets within a workbook called Jobs Workbook

The worksheets are named Concrete & Database

Concrete is the active worksheet

I need to archive cell data from Concrete & piggyback it onto the next
available row in Database (currently this worksheet has about 1100 rows of
active data in 30 columns).

Therefore from Concrete ( I would be using a button on it to assign the
macro to) I would like the macro coding to first find the next available row
after the last archived row(call it row n) in Database & using that address
move the following data from Concrete to to the relevant cells in Row n of
Database:

Concrete(E1) to Database(An)
Concrete(B3) to Database(Bn)
Concrete(B1) to Database(Cn)
Concrete(E5) to Database(Gn)
Concrete(B55) to Database(Jn)
Concrete(E2) to Database(Kn)

When this is done I need to go back to the acttive worksheet (Concrete) and
save the workbook.

At a later stage I will be using the found row number n - so I need to know
what to reference it by after this macro has found it

Thanks

Chris

Then save the workbook Jobs

Thank You
 
J

Jacob Skaria

Please try the below and feedback. Variable lngLastRow will have the last row

Sub test()
Dim lngLastRow As Long

With ActiveWorkbook.Sheets("Database")
lngLastRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
..Range("A" & lngLastRow) = ActiveSheet.Range("E1")
..Range("B" & lngLastRow) = ActiveSheet.Range("B3")
..Range("C" & lngLastRow) = ActiveSheet.Range("B1")
..Range("G" & lngLastRow) = ActiveSheet.Range("E5")
..Range("J" & lngLastRow) = ActiveSheet.Range("B55")
..Range("K" & lngLastRow) = ActiveSheet.Range("E2")
End With

End Sub
 
C

Chris Maddogz

Thank you for that - one other thing - was there a statement in there that
saved the workbook?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top