Hi All, i have 2 Private Sub Worksheet_change(ByVal Target As Range) codes that work on their own. i need them to work in the same sheet. whenever i do this the 2nd code does not run. how do i merge these please!!?
Code:
[Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range, cel As Range
Set rng = Intersect(Target, Range([H2], Cells(Rows.Count, "H").End(xlUp)))
If rng Is Nothing Then Exit Sub
Application.EnableEvents = False
rng.Offset(, 1).FormulaR1C1 = "=IF(RC[-1]<>"""",R1C[6] & ""-"" &" & "TEXT(COUNTA(R2C[-1]:RC[-1]),""0000"") & ""-"" & R1C[7],"""")"
Application.EnableEvents = True
End Sub
Private Sub Movr_blanks_To_Bottom(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 9 Then Exit Sub
Range("A1", Range("A" & Rows.Count).End(xlUp)).Resize(, 11).Sort key1:=Range("I1"), order1:=xlAscending, Header:=xlYes
End Sub]
thanks!
Code:
[Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range, cel As Range
Set rng = Intersect(Target, Range([H2], Cells(Rows.Count, "H").End(xlUp)))
If rng Is Nothing Then Exit Sub
Application.EnableEvents = False
rng.Offset(, 1).FormulaR1C1 = "=IF(RC[-1]<>"""",R1C[6] & ""-"" &" & "TEXT(COUNTA(R2C[-1]:RC[-1]),""0000"") & ""-"" & R1C[7],"""")"
Application.EnableEvents = True
End Sub
Private Sub Movr_blanks_To_Bottom(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 9 Then Exit Sub
Range("A1", Range("A" & Rows.Count).End(xlUp)).Resize(, 11).Sort key1:=Range("I1"), order1:=xlAscending, Header:=xlYes
End Sub]
thanks!