PDA

View Full Version : Solved: Extend Range selection Down



fredlo2010
06-01-2012, 07:29 AM
Hello,

To define a range using .end(xlDown)

After I recorded my macro this is what I got:

Range("C9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents

I am trying to modify it to something like the one below, but it does not work. What am I doing wrong?

I am trying to select cells from C9 to I9 and then expand my selection down.

ActiveWorkbook.Sheets("MyWorkbook") _
.Range("C9:I9", Range("C9").End(xlDown)).ClearContents


Thanks for the help

Bob Phillips
06-01-2012, 07:46 AM
WIth ActiveWorkbook.Sheets("MyWorkbook")
.Range(.Range("C9"), .Range("C9").End(xlDown)).ClearContents
End With

fredlo2010
06-01-2012, 07:56 AM
Thanks a lot

I got it now

In my spread sheet column "C" is the one that will always have complete data. So I modified it to fit my needs as:

With ActiveWorkbook.Sheets("MyWorkbook")
.Range(.Range("C9").End(xlDown), .Range("I9")).Select
End With