Hello,
I need some help figuring out how to update the below code to update existing values in column AR based on if specific text exists in column AP.
I'm pretty sure I will need to remove the "ClearContents" line, but not sure what I will need to do and was confused with what I found online.
I can provide sample data if needed, but a preliminary push to in the right direction would help.
Thank you,
I need some help figuring out how to update the below code to update existing values in column AR based on if specific text exists in column AP.
I'm pretty sure I will need to remove the "ClearContents" line, but not sure what I will need to do and was confused with what I found online.
I can provide sample data if needed, but a preliminary push to in the right direction would help.
VBA Code:
Sub RemoveOT_Tagging()
Dim sh As Worksheet
Dim lr As Long
Dim i&, rngZ, rngK, rngE, Z As String, K As String, E As String, RemoveTagging()
Set sh = Sheets("Audit_Plan")
lr = sh.Range("J" & Rows.Count).End(xlUp).Row
rngZ = sh.Range("AR7:AR" & lr).Value: rngK = sh.Range("AP7:AP" & lr).Value: rngE = sh.Range("AN7:AN" & lr).Value
ReDim CleanBusImp(1 To UBound(rngZ), 1 To 1)
For i = 1 To UBound(rngZ)
Z = rngZ(i, 1): K = rngK(i, 1): E = rngE(i, 1)
Select Case True
Case (E Like "O&T Area")
'Code to remove ICG O&T, PBWM O&T and LF - PBWM O&T of there is no indication drilled down
If (K = "ICG Operations") And (Z Like "*ICG O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/ICG O&T", ""), "ICG O&T/", ""), "ICG O&T", "")
ElseIf (K = "ICG Technology") And (Z Like "*ICG O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/ICG O&T", ""), "ICG O&T/", ""), "ICG O&T", "")
ElseIf (K = "LF - PBWM Operations") And (Z Like "*LF - PBWM O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/LF - PBWM O&T", ""), "LF - PBWM O&T/", ""), "LF - PBWM O&T", "")
ElseIf (K = "LF - PBWM Technology") And (Z Like "*PBWM O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/LF - PBWM O&T", ""), "LF - PBWM O&T/", ""), "LF - PBWM O&T", "")
ElseIf (K = "PBWM Operations") And (Z Like "*PBWM O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/PBWM O&T", ""), "PBWM O&T/", ""), "PBWM O&T", "")
ElseIf (K = "PBWM Technology") And (Z Like "*PBWM O&T*") Then
RemoveTagging(i, 1) = Replace(Replace(Replace(Z, "/PBWM O&T", ""), "PBWM O&T/", ""), "PBWM O&T", "")
End If
End Select
Next
With sh.Range("AR7").Resize(UBound(rngZ), 1)
.ClearContents
.Value = RemoveTagging
End With
End Sub
Thank you,