Copy and paste data using macro

D

Daz

Hello,
I am using a macro to drop numbers into cells D2:F2 these numbers are
changing so the macro I require is to place D2:F2 data into cells A2:C2 the
challenge i have is once cells A2:C2 are no longer blank how can run a macro
to place the next data from D2:F2 to blank cells A3:C3 then A4:C4 etc Cells
D2:F2 will always be constant cells with data changing when invoking the
macro.

Thankyou for looking at this for me
Kind Regards
Darrel
 
R

Rick Rothstein

Give this macro a try...

Sub CopyD2F2()
Dim Lastrow As Long
With Worksheets("Sheet8")
Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("D2:F2").Copy .Cells(Lastrow + 1, "A")
End With
End Sub

The above macro assumes, since you are starting in Row 2, that A1 contains
some text (the header for the column). If A1 will be blank, then the macro
will need to be adjusted.
 
D

Daz

Rick Rothstein said:
Give this macro a try...

Sub CopyD2F2()
Dim Lastrow As Long
With Worksheets("Sheet8")
Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("D2:F2").Copy .Cells(Lastrow + 1, "A")
End With
End Sub

The above macro assumes, since you are starting in Row 2, that A1 contains
some text (the header for the column). If A1 will be blank, then the macro
will need to be adjusted.
 
D

Daz

Rick Rothstein said:
Give this macro a try...

Sub CopyD2F2()
Dim Lastrow As Long
With Worksheets("Sheet8")
Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("D2:F2").Copy .Cells(Lastrow + 1, "A")
End With
End Sub

The above macro assumes, since you are starting in Row 2, that A1 contains
some text (the header for the column). If A1 will be blank, then the macro
will need to be adjusted.

--
Rick (MVP - Excel)




Thankyou Mr Rothstein, the macro works perfectly and will save me a large amount of time, Thankyou again
Kind Regards Daz
 

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