View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default how to get rid of selection of cells, after pasting

Turn off screenupdating, goto a cell (to select it) and then go back to where
you want to be. Then turn on screenupdating.

Orion wrote:

Hi Dave,

this would work nicely but I don't want to 'goto' Sheet1. It should
happen in the background.

Thanks,
Norbert

On Mon, 07 Feb 2005 19:18:01 -0600, Dave Peterson
wrote:

Another option is to just select A1 of that sheet.

application.goto worksheets("sheet1").range("a1"),scroll:=true

is one way.

Orion wrote:

Hi there,

below find the code, which I put into the workbook_open event.
When I open my file, Sheet3 will be active
On Sheet1 the cells getting selected, copied and their values pasted
back.
Everything works fine, and after the code has ended its job, Sheet3 is
active, but when I manually change to Sheet1, I can see, that all
cells had been selected before. (They have this dark appearance, not
the flickering frame)
How do I get only cell A1 selected?
It should also happen in the background, without having to select
Sheet1 first.

Private Sub Workbook_Open()
'
Application.ScreenUpdating = False
If Now() #2/3/2005# Then '#month/day/year#!!!!
With Worksheets("Sheet1").Cells
.Copy
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End With
End If
ActiveWorkbook.Save
Application.ScreenUpdating = True
End Sub

Thanks for any advice.

Regards,
Norbert


--

Dave Peterson