+ Reply to Thread
Results 1 to 3 of 3

Issue with "Worksheet_SelectionChange"

  1. #1
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Issue with "Worksheet_SelectionChange"

    Hi,

    I would really appreciate any advice on this if anyone can help.

    I have created some code for Worksheet_SelectionChange that returns a message (only when sheet is unprotected) when any cell in columns Q:P are selected.

    It works ok, however one issue I have is when you scroll over these cells using arrow keys on key board the code runs which is annoying as users may want to find data in these columns that way. They would soon get fed up as the message keeps popping up on every single cell movement.

    I would really like to find a way to only run the code when:
    1) The sheet is unprotected (which I have resolved)
    2) Only run code when cell is selected with mouse click.

    I guess what I am asking for is something that does not exist i.e. BeforeLeftClick event but was hoping there was some sort of work around.

    Code I am using below:

    Please Login or Register  to view this content.
    Regards
    Steve

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Issue with "Worksheet_SelectionChange"

    Hi, Steve@TRW,

    you´re correct about the non existence of s BeforeLeftClick-event but I´m afraid VBA alon will only get hold of the cell being selected and not how that is being done: mouse, cursor, tab.

    Running the code may be either done by unprotecting the worksheet prior to action and protecting it again at the end of the procedure or by using the Protect-Command with parameter UserInterfaceOnly:=True which is a volatile setting that is not saved with the workbook and should be set each time when opening the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Issue with "Worksheet_SelectionChange"

    Hi Holger,

    Thanks for your advice.

    Kind regards
    Steve

+ 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. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. [SOLVED] filling cell in column "a" if data present in column "b" issue.
    By timmatthews in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2013, 11:43 AM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. Replies: 3
    Last Post: 07-30-2013, 01:38 AM
  5. How to have a macro simply issue the "find" command or "control f:
    By Charles Adams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2005, 04:40 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