+ Reply to Thread
Results 1 to 11 of 11

Combining two Worksheet_SelectionChange Events help!

  1. #1
    Registered User
    Join Date
    07-28-2016
    Location
    notts
    MS-Off Ver
    2010
    Posts
    8

    Question Combining two Worksheet_SelectionChange Events help!

    Hi Guys, I have one worksheet_selectionchange which tracks and logs changes to a worksheet on a different worksheet. I have a second worksheet_selectionchange which prevents users from selecting multiple cells.
    I cannot for the life of me get them to work together, I can either track the changes or prevent multiple cells selection. I've copied my code below, is there anyone that can help get this working?
    The code to track changes;

    Please Login or Register  to view this content.
    And the code to prevent multiple cell selection;

    Please Login or Register  to view this content.
    Thanks in advance guys, of course let me know if I've broken any rules or anything.
    Last edited by tabbytomo; 07-29-2016 at 03:35 AM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining two Worksheet_SelectionChange Events help!

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Edit your post to use the code tags, then I can post your solution. Thanks!
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-28-2016
    Location
    notts
    MS-Off Ver
    2010
    Posts
    8

    Re: Combining two Worksheet_SelectionChange Events help!

    Sorry about that, that should be sorted now. Look forward to reading what you've got!

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining two Worksheet_SelectionChange Events help!

    Thanks for adding the CODE tags - it makes it much easier to read, and copy, your existing code.

    Try the following:
    Please Login or Register  to view this content.
    It should be a little more efficient than all those if statements.

  5. #5
    Registered User
    Join Date
    07-28-2016
    Location
    notts
    MS-Off Ver
    2010
    Posts
    8

    Re: Combining two Worksheet_SelectionChange Events help!

    Hi Olly, thanks for that, it still logs the training information, unfortunately I am still able to select multiple cells at once. It certainly is much easier to read and more efficient than what I'd managed to put together.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining two Worksheet_SelectionChange Events help!

    Apologies - I slightly misread your requirement. Change the Worksheet_SelectionChange code to:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-28-2016
    Location
    notts
    MS-Off Ver
    2010
    Posts
    8

    Re: Combining two Worksheet_SelectionChange Events help!

    Thanks so much, that is everything working as it should be! Suppose I'll start working through the differences now and learn how to do this sort of thing for myself. Again, thank you very much.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining two Worksheet_SelectionChange Events help!

    Happy to help, thanks for the feedback.

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Combining two Worksheet_SelectionChange Events help!

    Hi there,

    Take a look at the attached workbook and see if it does what you want.

    Your code can be made a LOT simpler by listing the various Categories in a hidden worksheet instead of in the VBA CodeModule.

    The code I've used is as follows:

    Please Login or Register  to view this content.
    Highlighted values can be altered to suit your own requirements.


    The mvaTargetValues variable is used to restore original data values in the event that a User deletes or copies multiple cells in a single operation.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files
    Last edited by Greg M; 07-29-2016 at 07:59 AM. Reason: Attachment added

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Combining two Worksheet_SelectionChange Events help!

    Post deleted - duplicated due to server problems
    Last edited by Greg M; 07-29-2016 at 08:13 AM.

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Combining two Worksheet_SelectionChange Events help!

    Post deleted - duplicated due to server problems
    Last edited by Greg M; 07-29-2016 at 08:12 AM.

+ 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] Combine Worksheet_SelectionChange and Worksheet_Change events
    By quetzalc0atl in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 01-10-2020, 12:55 AM
  2. Combining two worksheet change events
    By djfergie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2013, 11:07 AM
  3. Combining two Worksheet_Change Events
    By Fett2oo5 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-09-2013, 01:05 PM
  4. [SOLVED] Combining two opening events when file is opened
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2013, 03:28 PM
  5. Need help combining multiple Worksheet_Change events
    By rlbush2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2012, 04:51 PM
  6. [SOLVED] Combining Two Change Events
    By computerdan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-25-2012, 02:00 AM
  7. Replies: 0
    Last Post: 01-21-2006, 11:20 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