ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste data using macro (https://www.excelbanter.com/excel-programming/420111-copy-paste-data-using-macro.html)

daz

Copy and paste data using macro
 
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

Rick Rothstein

Copy and paste data using macro
 
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)


"Daz" wrote in message
...
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



daz

Copy and paste data using macro
 


"Rick Rothstein" wrote:

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)


"Daz" wrote in message
...
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




daz

Copy and paste data using macro
 


"Rick Rothstein" wrote:

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)


"Daz" wrote in message
...
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


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

Kind Regards Daz


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com