+ Reply to Thread
Results 1 to 8 of 8

Macro to automatically select a range

  1. #1
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Macro to automatically select a range

    Dear all,

    please have a look at the attached file. I would like a macro to autmatically select a specific range, starting with the active.cell ( which is always in Column B ) and then up until no entry is found in Column I. I have included a screenshot that shows the selection.

    Any help, thank you muchly !

    Felix

    EDIT: in this case, starting cell was B24, range is therefore B7:P24
    EDIT2: vertical range is always from Column B to Column P.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by elgato74; 03-15-2014 at 07:57 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Macro to automatically select a range

    In your spreadsheet there is no data beyond row 24. Is it possible that there could be more data contained in Rows 25 and beyond and that column I is not blank? Or will once you find column I blank, the rest of the column will always be blank. If that is the case, could you have more than one range you are looking to select. Also, once selected, what action will occur?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Macro to automatically select a range

    Hi there, there will be data beyon row24. this was just to demonstrate the range. Starting point is always the active cell in B. Then it needs to find the frist row with no date in Col I. Then that would be the range.

    Once selected, I will have another Macro executed.

  4. #4
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Macro to automatically select a range

    and yes, once it finds Col I blank, there will be no data beyond that in Col I

    EDIT: The row with the starting cell will also be the last row of the selection, no matter if there is data beyon that or not ...
    Last edited by elgato74; 03-15-2014 at 08:07 PM.

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Macro to automatically select a range

    I think you are looking for this

    Please Login or Register  to view this content.
    Last edited by Sc0tt1e; 03-15-2014 at 08:14 PM.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Macro to automatically select a range

    This worked for me:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Macro to automatically select a range

    Or something like this, given the current structure of the sheet, where the range depend on your activecell in column B:

    Please Login or Register  to view this content.
    Last edited by berlan; 03-15-2014 at 11:43 PM.

  8. #8
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Macro to automatically select a range

    Thank you !!!

+ 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. Automatically select filled cells range in textbox
    By Cleopatran in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2014, 06:23 AM
  2. Dynamic chart automatically changing its range if we select wrong date
    By maniknandi in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-06-2013, 12:46 AM
  3. Macro query - Automatically select yes
    By Andrew E Smith in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-27-2012, 09:27 AM
  4. Automatically Select Range Before Saving
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2010, 07:18 PM
  5. How do I make a macro automatically select Yes when a yes/no box appears?
    By JasonK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2006, 09:55 AM

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