Hi guys
I have two code of Worksheet_Change
One of them make negative number and other, doing a macro code
How compile this two into one?
Code 1
Code 2
I have two code of Worksheet_Change
One of them make negative number and other, doing a macro code
How compile this two into one?
Code 1
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E3:E1048576,G3:G1048576")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Value > 0 Then Target = Target.Value * -1
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
If Target.Count = 1 And Target.Column = 2 And Target.Row >= 67 Then
If (Target.Row - 34) Mod 32 = 0 Then
Application.EnableEvents = False
Application.ScreenUpdating = False
For i = 2 To 30840 Step 1
If Sheets("Sheet1").Range("B" & (34 - 2) * i + 2).Value <> "" Then
Sheets("Sheet2").Range("A" & 34 * (i - 1) + 7 & ":H" & 34 * i + 6).Copy Sheets("Sheet2").Range("A" & 34 * i + 7)
Else
Sheets("Sheet2").Visible = False
Application.ScreenUpdating = True
Application.EnableEvents = True
Exit Sub
End If
Next i
End If
End If
End Sub