When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the f
Select any cell and turn off cutcopymode.
Range("A1").Select
Application.CutCopyMode = False
If using a button to call the paste procedure,
try activating the button after the operation. this successfully clears the selection
without
HTH
Sub BtnCopypasta_Worksheet_Click()
range.copy
range.paste
BtnCopypasta.Activate
End sub
HTH
I had this issue with Excel 2013. I had "freeze panes" set, which caused the problem. The issue was resolved when I removed the frozen panes.
Just use
SendKeys "{ESC}"
thereby cancelling your selection.
None of the many answers with Application.CutCopyMode
or .Select
worked for me.
But I did find a solution not posted here, which worked fantastically for me!
From StackExchange SuperUser: Excel VBA “Unselect” wanted
If you are really wanting 'nothing selected`, you can use VBA to protect the sheet at the end of your code execution, which will cause nothing to be selected. You can either add this to a macro or put it into your VBA directly.
Sub NoSelect()
With ActiveSheet
.EnableSelection = xlNoSelection
.Protect
End With
End Sub
As soon as the sheet is unprotected, the cursor will activate a cell.
Hope this helps someone with the same problem!