Hi,
I need some help with an excel VBA function. I have data that looks like this
ColA ColB
a123 a123
a124 a124
a127 a126
a128 a127
.... ....
I want to compare the contents of ColA and ColB, Where the contents are different I want to insert a blank cell into column A. So the result will look like:
ColA ColB
a123 a123
a124 a124
a126
a127 a127
.... ....
Any suggestions as to how I could do this in Excel.
Thanks in advance
UPDATED
I tried the method below with the following code to insert the cell and it is working fine, I now realise when I run it that I need some more functionality though.
first_col.Cells(row, 1).Select
Selection.Insert Shift:=xlDown
if the value in ColA with the "a" removed is less than the value in ColB with the "a" removed I want to insert the cell in in ColA and I also need to insert a cell in the same position in ColC (contains other data). If ColB has a larger value I want to insert the cell in ColB only. I think I know what to do inside the If statement but I'm not sure how to construct the IF. Here is what I am thinking
Set other_col = Range("C1:C100")
//if substring of ColA > substring of ColB
first_col.Cells(row, 1).Select
Selection.Insert Shift:=xlDown
other_col.Cells(row, 1).Select
Selection.Insert Shift:=xlDown
//else
second_col.Cells(row, 1).Select
Selection.Insert Shift:=xlDown