+ Reply to Thread
Results 1 to 5 of 5

VBA Macro to find specified range depending on cell contents

  1. #1
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    VBA Macro to find specified range depending on cell contents

    Hello,

    This might be a bit of a tricky one to explain but here goes...

    In column A I will have a cell that says, for example "01AStart", and then another (further down the sheet) that will say "01AEnd". I want a macro that will find "01AStart" and then select that row through to "01AEnd" (including those rows).

    The number of rows between those two cells will vary at any time and there may be several rows between the two that contain no data at all, but the range that needs selecting must be 01AStart through to 01AEnd.

    Can anybody help? Hope it makes sense!!

    Thanks
    Last edited by lealea1982; 08-24-2011 at 07:40 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: VBA Macro to find specified range depending on cell contents

    lealea1982,

    Give the following a try:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

  3. #3
    Registered User
    Join Date
    05-13-2011
    Location
    New Zealander in London
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: VBA Macro to find specified range depending on cell contents

    Nice work tigeravatar. I had just written a 10-line macro to do what you achieved in 1.

    lealea if you want this to select those cells between start and end, use:
    Please Login or Register  to view this content.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA Macro to find specified range depending on cell contents

    Hi lealea1982

    Taking tarquinious and tigeravatar a little bit further; you said that you wanted to select the rows rather than just the cells, for rows try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Re: VBA Macro to find specified range depending on cell contents

    Perfect! Thanks guys!!

+ 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