Find header copy column to last row

JJCA99

Board Regular
Joined
Dec 4, 2014
Messages
50
Hello all,

Stuck on a code where I need to find key word and from that key word copy all rows below it.
I keep getting Method 'Range' of Oject' _ Global Failed error

Rich (BB code):
Rich (BB code):
Rich (BB code):
Header2 = Kps.Cells(5, 2) 
MtTabs = Cells(Rows.Count, 1).End(xlUp).Row
For q = 6 To MtTabs
MAITName = Kps.Cells(q, 1)
Family = Cells(Rows.Count, 7).End(xlUp).Row



Range(Sheets(MAITName).Cells.Find(what:=Header2).Offset(1, 0), Family).Copy ' My Error is here


Any help would be great!

Thanks,
JJ
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I did not understand some parts of your code, but I hope that the following example will help you


Code:
    Header2 = kps.Cells(5, 2)
    MAITName = kps.Cells(6, 1)
    Set h = Sheets(MAITName)
    Set b = h.Cells.Find(what:=Header2, LookIn:=xlValues, lookat:=xlWhole)
    If Not b Is Nothing Then
        lr = h.Cells(Rows.Count, b.Column).End(xlUp).Row
        h.Range(h.Cells(b.Row, b.Column), h.Cells(lr, b.Column)).Copy
    Else
        MsgBox "Header does not exists"
    End If
 
Upvote 0
That is it! Thanks Dante appreciate the help. -I was only including row numbers in my range of cells. Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top