+ Reply to Thread
Results 1 to 3 of 3

Macro does not run when piece is clicked, other macros do run.

  1. #1
    Registered User
    Join Date
    04-18-2024
    Location
    Greenville, SC
    MS-Off Ver
    Version 2108
    Posts
    1

    Macro does not run when piece is clicked, other macros do run.

    I am coding chess into excel and running into an issue where a macro attached to a piece that previously worked, does not work anymore. There is no error involved, it seems that the piece can't be clicked at all.
    In Module 1, It had ran smoothly until I added the If Then statements that are supposed to ensure that the moves list only had moves that are actually on the board.
    The macro is assigned to each chess piece on the board.
    Thank you.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,777

    Re: Macro does not run when piece is clicked, other macros do run.

    Once InvalidMove becomes True, it can never become False again. The first time you check the move is off the board, so Invalid move will be True until the end of the sub. You need to reset it each pass through the loop:

    Please Login or Register  to view this content.
    I don't know how this could possibly have worked before, unless you accidentally deleted a line like the one I inserted.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,777

    Re: Macro does not run when piece is clicked, other macros do run.

    By the way, just a tip: Don't post pictures of code. Paste the actual code into your post and then apply code tags by selecting the code and then clicking the # symbol in the edit controls.

+ 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. VBA which runs macros when cell clicked - 82% working
    By Kcroft9 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2022, 03:31 PM
  2. How to Run Different Macros Each Time a Button is Clicked
    By tkoziol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2021, 03:24 AM
  3. Macros to record data for different buttons that are clicked
    By LoKathrynMac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2014, 04:38 PM
  4. any macros that can auto populate if clicked?
    By chrishamar in forum Excel General
    Replies: 2
    Last Post: 03-06-2014, 11:38 AM
  5. [SOLVED] I need a macros that will only allow data entry when buttlons are clicked
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-27-2013, 02:38 PM
  6. run macros on entire network of computers once clicked
    By myjebay1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2012, 05:55 PM
  7. Need to run macros depending on msgbox button clicked
    By rosshkerr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-01-2012, 06:07 AM

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