Select Range of Cells Relative to The Current Cell RRS feed

  • Question

  • Excel 2016

    I am trying to write a macro that will select a range of cells relative to the current cell.  Say that the cursor is in G2330.  I need the VBA code to select A2331:C2331.  The range needs to be dynamic so I can't hard code the addresses.

    I found the following link that has a lot of good examples regarding using VBA to select ranges, but it doesn't seem to cover exactly what I want to do.

    Using the information from that article, I could define a range in the column headings, and then use example 12 (select a range of cells that is the same size as the named range), but I thought there might be a more elegant solution.

    So, how do I use VBA to dynamically select the first three columns of the next row?

    Thanks for any information that you can offer!


    Wednesday, January 31, 2018 6:31 PM


  • I figured this one out.  After a couple of hours, I came back to the issue and was struck with a new idea.  That new idea did not work, but it was close enough that with a little extra searching I found:

         Range(ActiveCell.Offset(0, -6), ActiveCell.Offset(0, -4)).Select


    • Marked as answer by thomasm516 Wednesday, January 31, 2018 10:06 PM
    Wednesday, January 31, 2018 10:06 PM