Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50099

Selecting a range of cells using ActiveCell where the start point is variable

$
0
0
Hi All

I'm trying to develop a code that selects a range of cells, copy's and pastes them to another sheet. The problem is that the second set of data is on the same sheet as the first set I can identify where the data starts as the table has "Service" in cell A* with * being a variable as the starting point changes week to week. so in today's book its A180 but next week it could be A150 etc. The bit i'm having problem with is i need to copy from the table the range A* to J* to the end of the table so i've put together the following but i'm struggling with the "Range(ActiveCell, ActiveCell.End(xlToRight)).Select" as its only going to "D*". I've tried recording macros to select the range to J but it just keeps returning the value I've selected. I.E. "Range("A180:J180").Select".

Code:

Range("A1").Select
    Cells.Find(What:="service", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
    Range(ActiveCell, ActiveCell.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

Can anyone offer any assistance

Kind Regards

John

Viewing all articles
Browse latest Browse all 50099

Trending Articles