Drisso in Vegas
New Member
- Joined
- Aug 23, 2018
- Messages
- 6
Hi All,
Here's one I can't seem to figure out. This code is to effect 2 sheets in this Excel 2016 workbook, "ROW" and "Project Summary". Column D of the ROW sheet has a pull down with a data validated list. One item in the list is "Pending Approval". Column E has the variable string "CIR" which usually repeats across multiple records. The Project Summary sheet has in column A the correlating CIR string but is not repeated, only one record per CIR. What I'm trying to do is when the pull down is changed to "Pending Approval" I want the value in the correlating row on Project Summary in column AA to change to "Update Pending Item", then if the pull down is changed to anything other than "Pending Approval" it should remove that text from Project Summary sheet.
I've found that if I manually add the text on Project Summary this code will remove it when changing the pull down to something else but it doesn't add the text when I change it back. I've been learning VBA for only a few months so I'm hoping I've just overlooked something simple.
BTW, this community ROCKS! I've learning tons from you guys. Thanks!
Here's one I can't seem to figure out. This code is to effect 2 sheets in this Excel 2016 workbook, "ROW" and "Project Summary". Column D of the ROW sheet has a pull down with a data validated list. One item in the list is "Pending Approval". Column E has the variable string "CIR" which usually repeats across multiple records. The Project Summary sheet has in column A the correlating CIR string but is not repeated, only one record per CIR. What I'm trying to do is when the pull down is changed to "Pending Approval" I want the value in the correlating row on Project Summary in column AA to change to "Update Pending Item", then if the pull down is changed to anything other than "Pending Approval" it should remove that text from Project Summary sheet.
I've found that if I manually add the text on Project Summary this code will remove it when changing the pull down to something else but it doesn't add the text when I change it back. I've been learning VBA for only a few months so I'm hoping I've just overlooked something simple.
BTW, this community ROCKS! I've learning tons from you guys. Thanks!
HTML:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cir As String
If Target.Column = 4 Then
Application.EnableEvents = False
If Target.Value = "Pending Approval" Then
cir = Target.Offset(0, 1).Value
Worksheets("Project Summary").Activate
ActiveSheet.Range("A6").Select
Do Until ActiveCell = ""
If ActiveCell = cir Then
ActiveCell.Offset(0, 26).Value = "UPDATE PENDING ITEM"
Exit Do
End If
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("ROW").Activate
End If
If Target.Value <> "Pending Approval" Then
cir = Target.Offset(0, 1).Value
Worksheets("Project Summary").Activate
ActiveSheet.Range("A6").Select
Do Until ActiveCell = ""
If ActiveCell = cir Then
ActiveCell.Offset(0, 26).Value = ""
Exit Do
End If
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("ROW").Activate
End If
End If
End Sub