how do get rid of a selection after pasting

  • Thread starter Thread starter Orion
  • Start date Start date
O

Orion

Hello everybody,

this is part of my code:
....
......
With Worksheets("Sheet1").Cells
.Copy
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
......
....

the code copies all cells of an (inactive) worksheet and pastes the
values back onto the worksheet, so that there are no formulas left
anymore.

When I return to that particular sheet, I can still see that all the
cells are selected.

How can I get rid of the selection?
I want the selected cell to be A1, but adding code for selecting cell
A1 did not help.

Please help.

Regards,
Norbert
 
Hi Norbert,

Add

Application.CutCopyMode = False

after the Paste

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
Hi Niek,

I have tried that as well. I know what it does. It just takes that
flickering frame from the cells, but the cells themselves are still
selected.

Regards,
Norbert


Hi Norbert,

Add

Application.CutCopyMode = False

after the Paste

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
Application.ScreenUpdating = False
With Worksheets("Sheet1").Cells
.Activate
set rng = Selection
.Copy
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
rng.Select
End With
Application.ScreenUpdating = True

or just

With Worksheets("Sheet1").UsedRange
.formulas = .Values
End With
 
Orion,

The following two lines of code work for me. Rob

Application.CutCopyMode = False
Range("A1").Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top