View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
excelent
 
Posts: n/a
Default Which cell was the activecell before a keypress

Hi fellows

I got 2 sheets excatly the same except the name
when i put a number in a cell and press enter, the number is copyed to the
other sheet too
but if i put in a number, and press Tab or left/right/up arrow the sub
dosent work
haw do i get to no what key was pressed? or what cell was active begore the
action?


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, ActiveCell.Offset(-1, 0)) Is Nothing Then Exit Sub
If Not IsNumeric(ActiveCell.Offset(-1, 0)) Then Exit Sub
Dim adr
adr = ActiveCell.Offset(-1, 0).Address
Sheets("Gr.1").Range(adr).Value = Sheets("Gr.1").Range(adr).Value +
Range(adr).Value
Range(adr).Value = ""
End Sub

any sugestion ?