Results 1 to 10 of 10

VBA select cell range based upon the # of rows that make up a certain merged cell?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    VBA select cell range based upon the # of rows that make up a certain merged cell?

    This is slightly confusioning.

    Are you able to specify the certain cell range that you want selected based upon how many rows make up a differnet certain merged cell?

    I ask, because my range of date changes depending upon how many rows the user deletes or inserts. The one constant that I can think of to reference my automatic selection back to is, the number of rows within the merged cell that is adjacent to my data range that I want selected.

    If you look at the attached. File - Sample12-30.xlsm

    I know there are different ways to select this data, but my goal here is to select data in Column H (only the dates that make up each phase). For instances, at different points in my custom macro, I want to select only the months that make up "Phase 2" and at other times I want to select the months in "Phase 1" and also "Phase 3."

    My current solution is to name the range (for instance in my sample doc, name H7:H12 - "months_in_phase1" and just call it out when needed.
    Range("months_in_phase1").Select
    But my problem is that, that range of data is dependent upon how many rows the user inserts or deletes. If the user deletes the last row of the name range in one instance and inserts another (which is possible) - then that name range quite isn't what it needs to be.

    THEREFORE, my only solution is to think that I need to copy only the number of rows (in Column H) that are contained in the merged cell titled 'PHASE #' - e.g so if "PHASE 2" contains 10 merged cells, then only copy 10 rows in Column H. So my question is, can that be done and how?


    THANK YOU SO MUCH FOR LOOKING AT THIS WITH ME.
    Last edited by clemsoncooz; 01-04-2012 at 12:22 PM.

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