Consulting

Results 1 to 3 of 3

Thread: Solved: Extend Range selection Down

  1. #1

    Question Solved: Extend Range selection Down

    Hello,

    To define a range using .end(xlDown)

    After I recorded my macro this is what I got:

    [VBA]Range("C9:I9").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents[/VBA]

    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.

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


    Thanks for the help
    Feedback is the best way for me to learn


    Follow the Armies

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]WIth ActiveWorkbook.Sheets("MyWorkbook")
    .Range(.Range("C9"), .Range("C9").End(xlDown)).ClearContents
    End With [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    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:

    [VBA]With ActiveWorkbook.Sheets("MyWorkbook")
    .Range(.Range("C9").End(xlDown), .Range("I9")).Select
    End With[/VBA]
    Feedback is the best way for me to learn


    Follow the Armies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •