PC Review


Reply
Thread Tools Rate Thread

Copy and paste data using macro

 
 
Daz
Guest
Posts: n/a
 
      17th Nov 2008
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
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      17th Nov 2008
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" <(E-Mail Removed)> wrote in message
news:0E9DEC86-1771-4473-833F-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Daz
Guest
Posts: n/a
 
      17th Nov 2008


"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" <(E-Mail Removed)> wrote in message
> news:0E9DEC86-1771-4473-833F-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
Daz
Guest
Posts: n/a
 
      17th Nov 2008


"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" <(E-Mail Removed)> wrote in message
> news:0E9DEC86-1771-4473-833F-(E-Mail Removed)...
> > 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to copy and paste all rows of data in between two words Stuart Microsoft Excel Programming 4 27th Apr 2010 07:21 AM
macro to copy data and paste to a new sheet in next available cell Neil Microsoft Excel Programming 2 25th Sep 2009 12:51 AM
Macro to copy & paste data Satish Microsoft Excel Misc 3 18th Dec 2008 04:50 AM
Macro to insert cells and copy/paste data Taffy Microsoft Excel Discussion 0 8th Oct 2005 06:45 PM
macro to copy paste non empty data paritoshmehta Microsoft Excel Programming 0 1st Jul 2004 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:11 AM.