+ Reply to Thread
Results 1 to 7 of 7

Add to Selection by Right Clicking & Union

  1. #1
    Registered User
    Join Date
    07-03-2014
    Location
    East Lansing
    MS-Off Ver
    2010
    Posts
    20

    Add to Selection by Right Clicking & Union

    I'm trying to make a code so that when optionbutton1 is checked, it allows you to right click to select a cell, then right click on a different cell and select that cell as well as the previous cell, etc. Here's What I have so far.

    Please Login or Register  to view this content.
    Last edited by TheSpriceEffect; 07-16-2014 at 09:37 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Add to Selection by Right Clicking & Union

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-03-2014
    Location
    East Lansing
    MS-Off Ver
    2010
    Posts
    20

    Re: Add to Selection by Right Clicking & Union

    Thank you so much! What about if left click then forget the selection?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Add to Selection by Right Clicking & Union

    Quote Originally Posted by TheSpriceEffect View Post
    Thank you so much! What about if left click then forget the selection?
    You're welcome.
    I don't understand?

  5. #5
    Registered User
    Join Date
    07-03-2014
    Location
    East Lansing
    MS-Off Ver
    2010
    Posts
    20

    Re: Add to Selection by Right Clicking & Union

    Right now, while right clicking it will add cells to the selection ever time you right click a different one, but there is no way to end that process. Lets say I've used that method to select a bunch of cells and then I changed a property about them. Then I want to clear this selection from the variable S so that I can start the right clicking process over again.

  6. #6
    Registered User
    Join Date
    07-03-2014
    Location
    East Lansing
    MS-Off Ver
    2010
    Posts
    20

    Re: Add to Selection by Right Clicking & Union

    Never mind, figured it out! thanks

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Add to Selection by Right Clicking & Union

    Remove this line from the previous code.
    Static S As Range 'Persistent

    Add this to the very top of any standard code module e.g. Module1
    Public S As Range

    In whatever procedure you run that changes the S range property, add this at the end of that procedure to reset the S range.
    Set S = Nothing

+ 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] Range/union
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2013, 10:35 AM
  2. Replies: 1
    Last Post: 02-07-2012, 07:09 AM
  3. VBA - Help with Union All
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2011, 05:14 PM
  4. Paste a Union range selection into email body
    By VD82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-23-2009, 05:47 PM
  5. [SOLVED] Union
    By Arne Hegefors in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2006, 11:30 AM

Tags for this Thread

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