+ Reply to Thread
Results 1 to 8 of 8

How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

  1. #1
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Question How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    I'm interested in whether there is a colored adjacent cells with moving and permanent position memory cells using VBA?

    Is there a possibility of using VBA in Excel?
    I have four positions,
    Please see attach and detailed described the problem.
    Attached Files Attached Files
    Last edited by Dumy; 01-04-2015 at 05:12 AM. Reason: SOLVED

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

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    Sure,
    Put this code in the sheet module for the sheet in question.
    Please Login or Register  to view this content.
    Then put this code in a normal module
    Please Login or Register  to view this content.
    Putting this in the ThisWorkbook module will automatically initialize without pushing the button.

    Please Login or Register  to view this content.
    Note that the X can push a colored cell off the top or left of the sheet, but it will not push itself off the edge.
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    @mikerickson, fantastic, I was not sure that this can be done in VBA, so I did not go into details.
    How to reprogram VBA that user can't push the red cell, if in the direction of pushing encounters a black cell containing the letter 'A'
    Please you see worksheet "situation1" in attached files
    Thank you for reporting and assistance
    Attached Files Attached Files

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

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    ..........

  5. #5
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    @mikerickson
    If you have time, please
    How can I limit the range of cells for pushing red cell.
    Therefore, only in a certain range VBA to push works.
    example range F2:R25

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    Hi,

    This is my try, please look at my attached file.

    The boundary area is defined by CellMove_BoundaryRange constant (range B2:J12, the purple area)
    The cell with its content is "A" is cannot pass-able.
    The code will "remember" the previous cell's color and formula (they will be restored if the block is out of the cell)

    To start, select cell F3 at sheet "after", then run macro CellMove_Start()
    To stop, run macro CellMove_Stop()

    Regards
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

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

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    Change the code in the normal module to this and it should work
    Please Login or Register  to view this content.
    Note that there can only be one cell that contains only X on the sheet in question.

  8. #8
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to push painted cell using the arrow keys or shape-arrow in Excel - VBA-Offset?

    @karedog
    Nice try VBA code, but result that's not what I wanted. Anyway thanks for the occurrence and your desire to help me.

    @mikerickson
    Thank you for your answers. Basically, this is what I wanted and everything works as I asked. Now I'm going to study your VBA code so that I knew that the next step I have to take.

    I have a small problem in a situation where they found two red cells one after the other in the direction of pushing. There would also be blocked by pushing direction.
    But, I do not want to bother you, so I'm going to look for the internet for further steps.

    Here's my unfinished work that I want to do for me (I am planning to create my own other levels)

    regards
    Attached Files Attached Files
    Last edited by Dumy; 01-04-2015 at 05:11 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] in excel - arrow keys won't work & cursor will not select a cell
    By jimmo in forum Excel General
    Replies: 2
    Last Post: 08-18-2006, 01:40 PM
  2. Replies: 3
    Last Post: 01-18-2006, 09:31 PM
  3. [SOLVED] How can I move the active cell in Excel with the arrow keys?
    By Chuck T in forum Excel General
    Replies: 3
    Last Post: 12-12-2005, 11:45 AM
  4. Arrow Keys in Excel
    By Claude in forum Excel General
    Replies: 3
    Last Post: 08-05-2005, 12:05 AM
  5. Arrow keys in Excel
    By mitch in forum Excel General
    Replies: 2
    Last Post: 01-24-2005, 05:06 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