How to copy rows from one worksheet to another based upon column heading text

Hardwick87

New Member
Joined
Oct 6, 2014
Messages
1
Hi,

I am very new to VBA and I am currently looking into developing a worksheet to carry out a cost comparison.

I have a programme which dumps raw data into an excel template (Sheet 1) which populates Cells A6 through to E6:

A6 - Labourer, B6 - Hour, C6 - Rate/Hour, D6 - No. of Hours, E6 Total Cost

In Cell A5 I have a heading called Labour which I want the Macro to search for and then copy all the data below until a blank cell is discovered and paste this info into Sheet 2.

Is this possible??
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

Try this:

Code:
Sub CopyRange()
    
    With Worksheets("Sheet1")
        .Range(.Range("A5"), .Range("A5").End(xlDown)).Copy _
            Destination:=Worksheets("Sheet2").Range("A1")
    End With
    Application.CutCopyMode = False

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,108,625
Messages
5,523,970
Members
409,548
Latest member
Buildingbysea

This Week's Hot Topics

Top