+ Reply to Thread
Results 1 to 5 of 5

Trying to run same macro on two different cells when selected

  1. #1
    Registered User
    Join Date
    04-15-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Trying to run same macro on two different cells when selected

    Hi, I'm very new to VBA and on one sheet am trying to run a macro to open a calendar when a particular cell is selected, I've managed to do this for one cell, but cannot find a way to run the same macro on a second cell selection within the same sheet. Is this possible?

    This is what I have so far:
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Trying to run same macro on two different cells when selected

    Hi Welcome to the forum

    Currently your macro will run if you select any cell in the range I25:M25. What do you mean by a your second selection?
    Regards,
    Rudi

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

    Re: Trying to run same macro on two different cells when selected

    Use a comma instead of a colon to separate the non-contiguous cells.

    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.

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Trying to run same macro on two different cells when selected

    If AlphaFrog has analysed your request correctly, you can also use the Union function.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-15-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Trying to run same macro on two different cells when selected

    Thanks RudiS & AlphaFrog, both work and have resolved the issue I was having.

+ 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] Please I need a macro to delete duplicate cells in a several selected cells in Excel?
    By amkoloui in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-15-2014, 02:17 PM
  2. create a macro that will perform another macro on selected cells
    By JMJ123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 12:44 AM
  3. Replies: 2
    Last Post: 08-28-2011, 02:39 AM
  4. Macro to select cells and then new selection from selected cells
    By Rewop Eilsel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2006, 11:25 AM
  5. [SOLVED] Macro to take selected cells times a selected cell
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2005, 08:05 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