JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
The macro below makes a copy of a range of cells just before updating them so I can see the changes. It was leaving the range selected, so I added the last statement, but the range is still left selected (walking dotted border).
How do I cancel the selection?
How do I cancel the selection?
Code:
Sub CopyErrorRow(inRowError As Long, inColLeft As Long, inColRight As Long)
Dim RngErrCurr As String 'The current error stats (source)
Dim RngErrPrev As String 'The previous error stats (destination)
RngErrCurr = Cells(inRowError, inColLeft).Address & ":" & Cells(inRowError, inColRight).Address
RngErrPrev = Cells(inRowError + 1, inColLeft).Address & ":" & Cells(inRowError + 1, inColRight).Address
Range(RngErrCurr).Select
Selection.Copy
Range(RngErrPrev).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Cells(1, 1).Select 'Cancel the selection
End Sub