Hi all,
I have a tracker which has options which move a row to another sheet in the workbook based on the selection.
For example, in Column F if I select "Booked" it will move the row into the Booked tab. I also have a "Remove from Tracker" option which deletes the row.
Here's the code I'm using:
I have sub statuses in Column G which I want to move to the other sheets based on the selection.
For example, when I select "Archive" in column F, I want to be able to select "Pharmacy" from column G and then have it move to the "Bucket 3" sheet. However, as this is a different Worksheet Change, i'm not able to add it to the current VBA code.
I would also like to add this code so it clears Column G once another selection is made in Column F. Here's the code for that:
If you could assist in combining the 3 codes I will be forever grateful. Thank you!
I have a tracker which has options which move a row to another sheet in the workbook based on the selection.
For example, in Column F if I select "Booked" it will move the row into the Booked tab. I also have a "Remove from Tracker" option which deletes the row.
Here's the code I'm using:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo errHandler
If Target = "Booked" Then
Call Booked_UnProtectSheet
Call Bucket1_UnProtectSheet
Range("A" & Target.Row & ":K" & Target.Row).Copy Sheets("Booked").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Target.EntireRow.Delete
Call Booked_ProtectSheet
Call Bucket1_ProtectSheet
ElseIf Target = "Remove from Tracker" Then
Call Bucket1_UnProtectSheet
Target.EntireRow.Delete
Call Bucket1_ProtectSheet
End If
errHandler:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
For example, when I select "Archive" in column F, I want to be able to select "Pharmacy" from column G and then have it move to the "Bucket 3" sheet. However, as this is a different Worksheet Change, i'm not able to add it to the current VBA code.
I would also like to add this code so it clears Column G once another selection is made in Column F. Here's the code for that:
VBA Code:
Private Sub Worksheet_Change1(ByVal Target As Range)
On Error Resume Next
If Target.Column = 6 Then
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
Target.Offset(0, 1).ClearContents
End If
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
End Sub