Hello Gurus!
I have 2 worksheet change event macros which both work fine separately but i want to include them on the same sheet. They are as follows:
and:
Any chance to do it?
I have 2 worksheet change event macros which both work fine separately but i want to include them on the same sheet. They are as follows:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim c As Range, i As Long
On Error Resume Next
Set c = Intersect(Target, Columns(1))
If c Is Nothing Then Exit Sub
If IsEmpty(c.Offset(-1, 0)) Or Not IsEmpty(c.Offset(1, 0)) Then Exit Sub
i = c.Row
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets("Formulas").Range("2:2").Copy
Sheets("ICS").Range(i & ":" & i).PasteSpecial xlPasteFormulas, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
Sheets("ICS").Range(iX & ":" & i).PasteSpecial xlPasteValidation, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
c.Select
Application.EnableEvents = True
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
and:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim lngCols(1 To 14) As Long
lngCols(1) = 12
lngCols(2) = 67
lngCols(3) = 68
lngCols(4) = 69
lngCols(5) = 71
lngCols(6) = 72
lngCols(7) = 73
lngCols(8) = 75
lngCols(9) = 76
lngCols(10) = 78
lngCols(11) = 80
lngCols(12) = 81
lngCols(13) = 83
lngCols(14) = 83
On Error GoTo ErrorHandler:
If Target.Columns.Count <> Columns.Count Then Exit Sub
For i = 1 To UBound(lngCols)
Cells(Target.Offset(-1, 0).Row, lngCols(i)).Copy
Cells(Target.Row, lngCols(i)).Select
ActiveCell.PasteSpecial xlPasteFormulas
Next i
ErrorHandler:
Application.ScreenUpdating = True
Application.CutCopyMode = False
End Sub
Any chance to do it?