Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 ? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Excelent,
Try replacing your code with: '============= Private Sub Worksheet_Change(ByVal Target As Range) Dim adr As String If Not IsNumeric(Target) Then Exit Sub On Error GoTo XIT Application.EnableEvents = False adr = Target.Address Sheets("Sheet3").Range(adr).Value = _ Sheets("Sheet3").Range(adr).Value _ + Range(adr).Value Range(adr).Value = "" XIT: Application.EnableEvents = True End Sub '<<============= --- Regards, Norman "excelent" wrote in message ... 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 ? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Norman
Perfect - just what i neded :-) tanks alot sry my french Denmark u no :-) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
Help with this conditional IF statement | Excel Discussion (Misc queries) | |||
resetting last cell | Excel Discussion (Misc queries) | |||
copying cell names | Excel Discussion (Misc queries) | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions |