Forgive me, because the past two weeks have been my first venture into VBA, so I'm very new at this (and this forum, which has been super helpful!).
If I understand correctly, you cannot add two separate instances of something like...
...because it will throw an "ambiguous" error.
So then, how do you successfully merge two separate of these codes without them interfering with each other?
I have a ton of different codes going on in multiple sheets as well as the Workbook which are all currently working via mostly trial and error, but I've tried to add in this one tiny piece of code to an existing Worksheet_Change, but it either doesn't work or breaks everything else (or both).
Example of script I want to add:
Example of existing script:
If I understand correctly, you cannot add two separate instances of something like...
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
...because it will throw an "ambiguous" error.
So then, how do you successfully merge two separate of these codes without them interfering with each other?
I have a ton of different codes going on in multiple sheets as well as the Workbook which are all currently working via mostly trial and error, but I've tried to add in this one tiny piece of code to an existing Worksheet_Change, but it either doesn't work or breaks everything else (or both).
Example of script I want to add:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("AR:AR").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "F").Value = Int(Now)
Else
Cells(Cell.Row, "F").Value = ""
End If
End If
Next Cell
End Sub
Example of existing script:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("AP:AP")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim Lastrow As Long
Lastrow = Sheets("Former").Cells(Rows.Count, "AP").End(xlUp).Row + 1
On Error GoTo ErrLoc
Application.EnableEvents = False
ActiveWorkbook.Save
If Target.Value = "Clear" Then
Rows(Target.Row).Copy Destination:=Sheets("Former").Rows(Lastrow)
End If
If Target.Value = "Remove" Then
Rows(Target.Row).Copy Destination:=Sheets("Former").Rows(Lastrow)
Rows(Target.Row).Delete
End If
End If
ErrLoc:
Application.EnableEvents = True
End Sub