+ Reply to Thread
Results 1 to 14 of 14

Simple Worksheet_Change Event Syntax Check

  1. #1
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Simple Worksheet_Change Event Syntax Check

    Trying to 1) remove the hyperlink, and 2) format paint (.PasteSpecial xlPasteFormats) a preferred non-contiguous range upon enter-click after entry of an e-mail address, that by default, jumps to Excel's normal style. Cannot get it to work. Help appreciated.

    Please Login or Register  to view this content.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    Simplified it a bit by creating a style and just applying that style in lieu of the format paint. Simplified to the following, but still not working when exiting the cell after text entry via "Enter". Thanks.

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    Friendly Bump

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Simple Worksheet_Change Event Syntax Check

    What is not working?
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  5. #5
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    Nothing happens. I enter an email address in the target cell "L48" and expect that upon enter, the hyperlink to be removed and a style applied. The result upon enter or clicking in another cell is a hyperlinked e-mail adress with the default 'Hyperlink' style of Calibri 12, light blue font.

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Simple Worksheet_Change Event Syntax Check

    Your code is working in 2013. Have you verified it is running?

  7. #7
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    How would one verify it's running? Isn't it always running/monitoring for changes and if within target, performing the actions?

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Simple Worksheet_Change Event Syntax Check

    Not if events have been disabled. You may place a breakpoint on the first line and then enter a hyperlink to see if the code will react.

  9. #9
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    In a blank 2013 workbook with one sheet as "Sheet 1", and the code residing in that sheet object (not a module), I entered an e-mail address into L48 and nothing happened. I then deleted the L48 contents, set a breakpoint at the first line, reentered an e-mail in L48, pressed enter to exit the cell (whereby changing the value of the cell from nothing to a text string that happens to be an e-mail address), and the code does not react.

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Simple Worksheet_Change Event Syntax Check

    I think you have disabled events then. Please run this and repeat the test after:
    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    Ran and re-tested. Still nothing.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Simple Worksheet_Change Event Syntax Check

    After you get events re-enabled and make sure the code is in the correct sheet module, there's no need to disable events.

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  13. #13
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Simple Worksheet_Change Event Syntax Check

    If you enter something in any cell is the code triggered?

  14. #14
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Simple Worksheet_Change Event Syntax Check

    On 2nd look, it was the events. Thank you both.

+ 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. Worksheet_Change event
    By serge.pigeot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-25-2012, 03:20 AM
  2. Worksheet_Change Event won't run more than once
    By David McMillon in forum Excel General
    Replies: 2
    Last Post: 07-08-2010, 04:02 PM
  3. Using Worksheet_Change Event
    By John99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 08:26 AM
  4. Worksheet_Change Event
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2009, 04:45 AM
  5. Worksheet_Change Event
    By safflenow in forum Excel General
    Replies: 1
    Last Post: 06-27-2005, 01: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