+ Reply to Thread
Results 1 to 4 of 4

Range selection in macro

  1. #1
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Range selection in macro

    HI All,

    Here is my recorded macro.

    Please Login or Register  to view this content.
    I was wondering if I can remove the H2:H17323 and have something like H2:H & Lastrow
    also for I2:I17823. there are alot of ranges like these in the complete macro.

    THANKS
    KIND REGARDS

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,440

    Re: Range selection in macro

    Something like:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Range selection in macro

    HI TMSHUCKS thanks alot. I was wondering if we were to do filter after vlookup on column H,
    remove some rows and concatanate column I will it still pick the changed range of 1LR after filtering.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,440

    Re: Range selection in macro

    That code finds the last row depending on the values in column A. That was chosen arbitrarily because it is quite often the key field on a data sheet.

    However, if the bottom rows are hidden, they will be ignored, so the results could be misleading.

    If the last row is visible, it doesn't matter how many intermediate rows are hidden.

    If you filtered and removed some rows and either turned the filter off or the last row was visible, you'd need to run that line of code again to refresh the value.

    Maybe you should experiment to see what you get.

    Use
    Please Login or Register  to view this content.
    in the Immediate Window to quickly check the effects of filtering, particularly if the last row(s) are hidden.


    Regards, TMS

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to get selection range in Macro?
    By Cuibi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-28-2013, 05:23 AM
  2. Macro range/selection question
    By Steffen Thomsen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-28-2010, 05:17 AM
  3. Applying a macro over a range/selection
    By HydroXidE1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2009, 06:02 AM
  4. Macro relative range selection
    By griz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2008, 05:12 AM
  5. Range selection-a macro on the net
    By m1ke in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2006, 12:42 PM

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