hotmochaccin
05-30-2022, 02:49 AM
Hello :)
I'm trying to use an IF statement to find and replace data from table.
Example:
City A | Account A | Account B | City B
New York | AAA | AAA | New York <- case 1 correct, skip
Newark | BBB | CCC | Denver < - case 2 correct, skip
Chicago | DDD | DDD | . <- case 3 incorrect, if Account A = Account B, then replace "." (City B) to City A
For now I have:
Dim Ary As Variant
Dim i As Long
Ary = Worksheets("X").ListObjects("Y").DataBodyRange.Value
For i = 1 To UBound(Ary)
ActiveWorkbook.Worksheets("X").Range("D:D").Replace ".", Ary(i, 1), xlWhole, xlWhole, False, False, False
Next i
But I don't know how to add the value condition (check if Accounts are equal)... Can someone suggest me how to do this? :)
I'm trying to use an IF statement to find and replace data from table.
Example:
City A | Account A | Account B | City B
New York | AAA | AAA | New York <- case 1 correct, skip
Newark | BBB | CCC | Denver < - case 2 correct, skip
Chicago | DDD | DDD | . <- case 3 incorrect, if Account A = Account B, then replace "." (City B) to City A
For now I have:
Dim Ary As Variant
Dim i As Long
Ary = Worksheets("X").ListObjects("Y").DataBodyRange.Value
For i = 1 To UBound(Ary)
ActiveWorkbook.Worksheets("X").Range("D:D").Replace ".", Ary(i, 1), xlWhole, xlWhole, False, False, False
Next i
But I don't know how to add the value condition (check if Accounts are equal)... Can someone suggest me how to do this? :)