How can I deselect after paste special
Thanks to all for the tips. When noe of them worked, I decided ot back up in
my function and discovered that my original Insertion rows were stillactive,
not my "copy" targets. SO I re-did my insertion using:
Rows(myInsertionPt).Resize(count).Insert shift:=xlDown
after which I was able to use several of the preceding tips to both improve
my pastespecial and the performance of my code.
Thanks to ALL of you, VERY much.
"Gary Keramidas" wrote:
another way:
Sub test()
Dim ws As Worksheet
Dim ws2 As Worksheet
Set ws = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
Application.ScreenUpdating = False
With ws
.Range("B5:D5").Copy
ws2.Range("b5").PasteSpecial xlPasteFormulas
End With
Application.CutCopyMode = False
ws.Select
ws2.Select False
Range("A1").Select
ws.Select
Application.ScreenUpdating = True
End Sub
--
Gary
"DJay" wrote in message
...
Using Excel 2003. I have a VBA program that must copy ONLY the FORMULAS and
FORMATS form a given row to a SELECTED range. The paste works fine, but when
the paste finishes, the target cells are still "selected" and have the
selection border around them. I have used Application.CutCopyMode = False to
turn off the selection on the SOURCE cell (which DOES work) and have tried
all of the following to de-select the target cells:
1. select a new area
2. range (1,1)=range(1,2)
3. re-activate the sheet
4. SendKeys {ESC} (also HOME and LEFT)
5. actiivate a ifferent sheet and re-activate the current sheet
None of these de-selects the target area, but if I click on the actual
sheet, I can use ESC, left-arrow, HOME, etc to cause the de-select. ANY
"select" statements following the paste special, cause an error. Any clues.
(I cannot use simple COPY as I do NOT want to copy the data - ONLY formulas
and formats.)
Any hints would be appreciated.
|