This statement --> ElseIf rng2.Value <> dstRng Then MsgBox rng2.Value & " not in RVP Group GAAP sheet" is not being recognized for some reason, and I made sure to set values not equal to each other. Basically I am trying to apply error handling to my if statement below. it works perfectly when the two ranges match just not when values do not match...
Set wb2 = ThisWorkbook Set Ws2 = wb2.Sheets("Output - Flat") Set Ws1 = wb1.Sheets("RVP Local GAAP") Set rng = Range("CurrentTaxPerLocalGAAPProvision") Set rng2 = Range("CurrentTaxPerGroupGAAPProvision") Set ws1A = wb1.Sheets("RVP Group GAAP") Set ws3 = wb1.Sheets("Index") Ws2.Range("CorpTaxEntityName").Copy ws3.Range("D4").PasteSpecial xlPasteValues For Each rng2 In Ws2.Range("NamedRange") Set dstRng = Nothing On Error Resume Next Set dstRng = ws1A.Range(rng2.Value) On Error GoTo 0 'Check that the range exists in destination sheet If Not dstRng Is Nothing Then 'Check that the range exists in the appropriate area If Not Intersect(dstRng, ws1A.Range("CurrentTaxPerGroupGAAPProvision")) Is Nothing Then ''MsgBox "succesful" ''found = False 'Transfer the value from the next column to the appropriate range in the 'destination sheet dstRng.Value = rng2.Offset(0, 1).Value ElseIf rng2.Value <> dstRng Then MsgBox rng2.Value & " not in RVP Group GAAP sheet" End If End If Next
Last edited by a moderator: