+ Reply to Thread
Results 1 to 10 of 10

Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

  1. #1
    Registered User
    Join Date
    04-27-2015
    Location
    Houston, Texas
    MS-Off Ver
    2013
    Posts
    49

    Talking Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Hey Excel gods. Needing help with this challenging task and I hope I can properly articulate the challenge and desired outcome

    Here is the scenario:

    1) I have 2 Sheets (Sheet1 & Sheet2). Sheet 2 is a Hidden Sheet.

    2) In Sheet1, I have the Cells, D1,D23,D50 and D70 and A1

    Macro Challenge/Criteria:
    a) I'd Like a Macro that kicks in when D1 (or D23 or D50 or D70) in Sheet1 is double-clicked, a thick black border around the cell appears.

    b) When cell A1 is also double-clicked (after either D1, D23,D50 and D70), the cell is given a thick Red border and THEN a copy of Sheet2 (Hidden Sheet) is created and made visible

    c) The newly created copy of Sheet2 is named based on the values in cells A1 & D1 or D23 or D50 or D70 & the current date
    (e.g. if Cell D1 has the value "Tom" and A1 has the value "Jones" and the macro was run on the date June 20, 2015, then the name of the copied sheet would be "Tom_Jones_June20_2015").

    d) if the new sheet created already has a sheet with the same name, in (c) above, then add an increasing number to the end of the name (e.g. the copied sheet would be "Tom_Jones_June20_2015_2" or "Tom_Jones_June20_2015_3"..etc

    e) Double clicking any of the cells already double clicked (as indicated by thick cell border) would make the borders disappear.

    I Hope I laid out the needs/requirements for the macro. Pls help.
    Thanks

    Regards
    H.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Hi harryco79,

    Try the attached file that contains the following code. I added the following rules which can be changed if they do not suit your needs:
    a. Only one cell in column D is allowed to have a thick Black Border.
    b. If there are no cells in Column D with a Thick Border, the Thick Border is removed from Cell 'A1'.
    c. D1, D23, D50, or D70 MUST be NON-BLANK in order to have a red border created around Cell 'A1'.
    d. Cell 'A1' MUST be NON-BLANK in order to have a red border created.
    NOTE: Excel has a 31 character limitation on Sheet Names.

    In the Sheet1 code module:
    Please Login or Register  to view this content.


    In an ordinary code module such as Module1 or ModCloneSheet2:
    Please Login or Register  to view this content.
    Lewis

    NOTE: The attached file does NOT work in Excel 2010. See the file associated with post #9 in this thread for a file that works in Excel 2003 and Excel 2010.
    Last edited by LJMetzger; 06-30-2015 at 03:43 PM. Reason: Added note re Excel 2010

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    If you put this in the code module for sheet1, it should do what you want.
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    04-27-2015
    Location
    Houston, Texas
    MS-Off Ver
    2013
    Posts
    49

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Oh wow. You guys are Excellent
    Thanks for the speedy response
    Will give both a whirl and test and report back soonest!

  5. #5
    Registered User
    Join Date
    04-27-2015
    Location
    Houston, Texas
    MS-Off Ver
    2013
    Posts
    49

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Thanks Lewis.
    I attached the Workbook to show how I have tested it.
    It works fantastic except the new sheets being generated with the Unique Sheet names only show one at a time (i.e the current sheet generated is visible and the previous ones are hidden sans their unique sheet names).

    Pls how can the code be modified to rectify this?

    Thanks

  6. #6
    Registered User
    Join Date
    04-27-2015
    Location
    Houston, Texas
    MS-Off Ver
    2013
    Posts
    49

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    nikerickson,
    Thanks for your code. It works great!!!! ...but slightly a bit different than planned.

    Here are the 2 issues with the results When the macro is activated;
    a) By the double click of Cell "A1", the copy of sheet 2 that is generated is hidden automatically, and
    b) It is sheet1 that is named uniquely instead of the newly generated copy of sheet2 (which should be visible)..all the copies of sheet2 generated should be visible with the unique names

    Does that make sense?

    Thanks so much for the time taken to help with this!!!

    Quote Originally Posted by mikerickson View Post
    If you put this in the code module for sheet1, it should do what you want.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Harry,

    It works fantastic except the new sheets being generated with the Unique Sheet names only show one at a time (i.e the current sheet generated is visible and the previous ones are hidden sans their unique sheet names).
    There seems to be a discrepancy between Excel 2003 (where the software was written) and Excel 2010 where I tested after you reported the problem. I will try to have a fix for you by tomorrow afternoon.

    Lewis

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    change this bit to make the new sheet visible

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    Try the attached file which has been tested using Excel 2003 and Excel2010, and seems to work for me in both versions of Excel.

    Lewis

  10. #10
    Registered User
    Join Date
    04-27-2015
    Location
    Houston, Texas
    MS-Off Ver
    2013
    Posts
    49

    Re: Macro to Double Click 2 cells to create a copy of a Hidden Sheet.

    LJMetzger & mikerickson,
    Thank you guys so much with your help on this. I really appreciate it (you have no idea). I have been out of the office on medial leave and only now just getting around to properly testing/using your solutions to my query. I apologize for the delay in feedback (it could not be helped).
    Will give both a whirl and report back soonest.
    Thanks thanks Thanks again!!!!
    - Harry

+ 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 cell - copy data to new sheet - create a list from double clicking
    By kakky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-04-2015, 11:14 PM
  2. Double click to copy cells and paste elsewhere
    By porko5079 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2015, 04:50 AM
  3. [SOLVED] Copy data to another sheet a double click option vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2014, 06:49 PM
  4. Copy double-clicked cell to next empty row in different sheet with each double-click
    By erhathaway in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-25-2013, 12:06 AM
  5. Create macro upon double click cell display filter in new sheet
    By kamalhilmi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-14-2012, 07:40 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