+ Reply to Thread
Results 1 to 6 of 6

assign double click event for multiple cells - easier way?

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    long beach, california
    MS-Off Ver
    Excel 2003
    Posts
    41

    assign double click event for multiple cells - easier way?

    Hey all. I have a column of values from C4:C42. Each value in each cell is the name of another worksheet in the workbook. when you double click the cell - it unhides the corresponding worksheet. I have been successful in coding each cell individually - but I am hoping there is an easier way to do this. Here's what I got:

    Please Login or Register  to view this content.
    Is there an easier way than having to do this all the way to C42? All help is appreciated.
    Thanks
    J

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: assign double click event for multiple cells - easier way?

    Try...

    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,830

    Re: assign double click event for multiple cells - easier way?

    Another option:
    Place this macro in the code module for the "RevenueALL" sheet.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: assign double click event for multiple cells - easier way?

    Can you post a sample of the file, would make reviewing and testing easier for those trying to help.

    When you say coding each cell individually, what do you mean? Do you mean you have the above snippet repeated where C4 becomes C5, C6, etc to C24?

    You can use Target instead of statically naming the cell, as target is the cell that was doubleclicked. IE: if you double click C4, target = C4. If the cells have the sheet name in them (exact) then you can replace sheet names where needed in your code with target.value. IE: if you double click C4, then target.value = C4's content, which should be the desired sheet name.

    Also, what is the reason behind hiding/showing sheets in this fashion? I ask as hidden sheets are great for preventing accidental changes on a relatively static sheet, for example a sheet used as the source for many drop down validation lists on another sheet. If however you are just using it as a means of navigational aide (preventing people from needing to scroll through tabs to select a sheet), then you could entirely ditch hiding and just use hyperlinks to each sheet, you wouldn't even need a macro for that. Likewise on each sheet you could put a link back to the "Table of Contents" sheet with all the links. You could, if you wanted, also set a workbook_close event to simply activate the table of contents sheet when they are finished so it always opens for others to the TOC sheet.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  5. #5
    Registered User
    Join Date
    07-07-2010
    Location
    long beach, california
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: assign double click event for multiple cells - easier way?

    CK76 & Mumps1 - thank you! both code snippets worked just fine - I am adding these to my personal reference notebook for future use.
    Zer0Cool - great reading between the lines - I am using this for navigation - and wasn't even aware of the hyperlink - which makes this much easier to modify. I will be moving this direction.

    thanks again all!
    J

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,830

    Re: assign double click event for multiple cells - easier way?

    You are very welcome. . Glad to help.

+ 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. double click event on range of cells
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2015, 08:27 AM
  2. [SOLVED] Before double click event with if statements (Double clicking blank cell stops bdc firing)
    By camdenpars in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2014, 09:03 AM
  3. Click v double click event code
    By Greg J in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2014, 04:08 AM
  4. [SOLVED] Double click event with multiple if statements
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-24-2014, 01:20 AM
  5. [SOLVED] Double Click Event to change and limit other cells
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2013, 05:03 AM
  6. Double click event
    By baz0912 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2008, 05:56 PM
  7. [SOLVED] userform label double-click goes to click event
    By John Paul Fullerton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2006, 01:00 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