Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello group,
here is the code. This is how it works, when a cell in the range G12:G511 is manually modified, some valors (the result from a substraction and the current date and time) are written in contiguous cells, when a valor is deleted from any cell in that range, the other two valors are deleted automatically. The code works fine until you try to delete 2 or more cells in the range, at once. If you try, an error window will pop asking for the finishing of the macro or to debug it. Hopping someone can help me with this. Thank you! Private Sub Worksheet_Change(ByVal Target As Range) With Application If .Intersect(Target, Me.Range("G12:G511")) Is Nothing Then Exit Sub If Target.Offset(, -4) = 0 Then .EnableEvents = False Target.Offset(, -4) = Now .EnableEvents = True End If If Len(Target.Offset(0, 0)) = 0 Then .EnableEvents = False Target.Offset(, -4) = "" .EnableEvents = True End If If Target.Offset(0, 0) < 0 Then Me.Cells(4, 7).Value = (Me.Cells(4, 4).Value - Target.Offset(1, -5).Value) End If If Target.Offset(0, 0) = 0 Then Me.Cells(4, 7).Value = (Me.Cells(4, 4).Value - Target.Offset(, -5).Value) End If End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Deleting Columns | Excel Discussion (Misc queries) | |||
Deleting Worksheet Error | Excel Programming | |||
Error when deleting sheets | Excel Programming | |||
error runtime 9: deleting a worksheet | Excel Programming | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming |