+ Reply to Thread
Results 1 to 4 of 4

Selecting Range next to ActiveCell

  1. #1
    Registered User
    Join Date
    09-26-2005
    Posts
    39

    Selecting Range next to ActiveCell

    If I am on cell C5 for example, what line in my macro will make Excel select the range that is the 4 cells next to it.

    On cell C5, I want it to select the range C5:G5 but do so dynamically so I can have it triggered by a number as it loops through a report?

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon ChrisF79

    There's probably a much faster, more efficient way of looping through cells than selecting each one, performing the action and moving on to the next, but in the absence of any other info, I'll just provide an answer to your question :

    Please Login or Register  to view this content.
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    As dominic said, there's probably a more efficient way to parse through your data and do what you need, but as an alternative to dominic's line of code, the following might be a bit easier to work with:
    Please Login or Register  to view this content.
    The row and column resize values (1 & 5 respectively) can be assigned to variables or cell values, too.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Another couple of ways.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1