We help IT Professionals succeed at work.
Get Started

Copy Entire Row and Paste into a new Worksheet Excel VBA

Last Modified: 2012-05-09
Hi there,

Hoping someone can assist with the code below. I am new at VBA and have been researching ways to achieve this on the net and this is what I have thus far.

Sub SendtoStorage()
Dim LastRow as Integer
LastRow = Sheets("ResultsLog").Range("B" & Rows.Count).End(xlUp).Select

'Copy Entire Row'
    If c Is Nothing Then
        LastRow = LastRow + 1
        olData.EntireRow.Copy _
          Destination:=Sheets("Storage").Range("A" & LastRow)
      End If
   End With

I am trying to copy the entire row from Sheet "ResultsLog", Range "B4:Y253" if the rows are populated. I want the rows to be copied to the destination sheet "Storage" starting in A2. Data will continually be added to this so it must find the next empty row and paste the data in column A etc.
Once this data has been copied, it needs to clear the contents in "ResultsLog", Range"B4:Y253".

Hope this makes sense. I'm sure I'm totally incorrect with my code, but really did try to give it a go. When I use the recorder it doesn't work.
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE