contramonk
06-02-2015, 06:48 PM
I'm a noob at VBA and I am trying to solve a macro problem that I thought would be easy.
I want to compare the string values of two columns to each other. If they are not equal I would like to highlight the row. Here is my feeble attempt:
Sub EqualityCheck()
For Each c In Worksheets(1).Range("A").Cells
If c.Value <> Range("B").Value Then...
Next
End Sub
However I keep getting an error (which is not surprising). Run-time error '1004': Application-defined or object-defined error. I am imagining this is because VBA doesn't like it when I refer to the column as "A".
I am sure that line 3 also fails, because the loop will not know which row in column B to check.
Any help is greatly appreciated, I've searched and searched for an answer that would help me with this problem. No luck.
I want to compare the string values of two columns to each other. If they are not equal I would like to highlight the row. Here is my feeble attempt:
Sub EqualityCheck()
For Each c In Worksheets(1).Range("A").Cells
If c.Value <> Range("B").Value Then...
Next
End Sub
However I keep getting an error (which is not surprising). Run-time error '1004': Application-defined or object-defined error. I am imagining this is because VBA doesn't like it when I refer to the column as "A".
I am sure that line 3 also fails, because the loop will not know which row in column B to check.
Any help is greatly appreciated, I've searched and searched for an answer that would help me with this problem. No luck.