View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default I've killed the copy process

Hi Ken...

Try to read your code...

If your selected cell is not in the rosterblock..
What happens? It'll give you a messagebox AND navigate to row 6

To have these handlers work only on single cell selections, you'd
normally include a line to check that the user is just navigating,
not making a selection...

Make this your first line.

If Target.cells.count 1 then exit sub






keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Ken McLennan wrote :

G'day there One and All,

Back again with another head scratcher.

In my ThisWorkBook object event code I've put in place a routine
to move the cursor down on exit from a cell if that cell is in the

first
column. Any other cell has the usual cursor right. There are a few

other
lines, but the code for this function is the culprit.

If I 'rem' it out, then copy works fine. If I deploy the code

then
on that page I can't copy or cut anything. I can copy from another

page
to cells there, but not from. If I select a range I get the "marching
ants" indicator, but when I select another cell to copy to they just
disappear and there's nothing in the clipboard.

I suspect that my code is interfering with the system's method of
using cursor movement in cut/copy procedures, but it's only a guess.

In
any case, does anyone know how to get around the problem?

Thanks in advance,
Ken McLennan
Qld, Australia

Here's my code: (Which is paraphrased from suggestions given by Bernie
Deitrick & Tom Ogilvy)

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
' Set directions for cursor movement
On Error Resume Next
If Intersect(Target, Range("rosterBlockHd")) Is Nothing Then
If Sh.Name < "Roster - Diary Of Duty" Then Exit Sub
If Target.Column = 1 Then
Application.MoveAfterReturnDirection = xlDown
Else
Application.MoveAfterReturnDirection = xlToRight
End If
Else
MsgBox "Sorry, can't select Header Block cells"
Cells(6, Target.Column).Select
Exit Sub
End If
End Sub