VBA for Escape key

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: VBA for Escape key

  1. #1
    Board Regular
    Join Date
    Jul 2009
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA for Escape key

     
    How do I do the equivalent of hitting the escape key in VBA?

    When I do a copy and paste in VBA, on screen in the spreadsheet it leaves the section highlighted or outlined. I do not want to see that residual outline of the area I copied or pasted. In normal usage, I would just hit the escape key to deselect the highlighted cells. How do I do that in VBA?

  2. #2
    Board Regular
    Join Date
    Apr 2004
    Location
    Still in Kansas
    Posts
    367
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA for Escape key

    For a workaround, add this at the end:

    Range("A1").ClearOutline

  3. #3
    Board Regular
    Join Date
    Apr 2004
    Location
    Still in Kansas
    Posts
    367
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA for Escape key

    Or this is more like it:

    SendKeys ("{ESC}")

  4. #4
    New Member
    Join Date
    May 2017
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA for Escape key

    For anyone else looking
    This will take the marching ants away from the cells of a copied range

    Application.CutCopyMode = False

  5. #5
    New Member
    Join Date
    Apr 2015
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Marching Ants

    Quote Originally Posted by EFANYoutube View Post
    For anyone else looking
    This will take the marching ants away from the cells of a copied range

    Application.CutCopyMode = False
    I tried the above and the sendkeys('esc') without success. The marching ants remain.

    The only solution I've found is to back out to the 1703 build

    cd %programfiles%\Common Files\Microsoft Shared\ClickToRun
    officec2rclient.exe /update user updatetoversion=16.0.7967.2161

    And then turn off automatic updates.

    I'm hopeful a better solution can be found as this was not a problem until the 1704 or 1705 update - i'm not sure which as i was told to go back to 1703.

  6. #6
    New Member
    Join Date
    Dec 2010
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Marching Ants

      
    Try this:

    SendKeys "{ESC}"
    DoEvents

    Notice that the parens/quotes are different. This works for me using Excel 2016 MSO (16.0.7726.1049) 64-bit on a Win10 Pro x64 version 1703 build 15063.540.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com