View Full Version : Help with VBA Code: cell values and matching values

07-17-2018, 08:27 AM
Basically, I want to compare the value of a cell with a whole column.

I want to start comparing the first cell with the first cell in the column. If all 4 digits match, then I want to print that value in a separate cell. If only the first 3 digits match, I want to print that value and times it by 10. If only two digits match, I want to start comparing that cell with the next cell down in the column. I want to continue this process until either the cell finds a "match" or there is nothing left in the column to compare to.

I don't really know how to do this. Let's say the first cell I want to compare is C15, and the column is right next to it from D15 : D75. How would I form this code in VBA? Once I'm done comparing the first cell to the entire column, I would also like to move down and continue on with the process. What I mean is move down to cell C16, and then compare that cell to the entire column from D15 : D75. Thank you!