Urgent-formating of columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all
I am a newbie,and looking urgently for help.Any comments will be appreciate
I have two columns in a spreadsheets as below.I want to match these two columns and insert a blank cell in column No2 where the two values in the cells dont match.For example I want to insert a blank cell in column before A2 in No2 and one blank cell after A2 to match A3 etc .How do I go about this?
No1 No
A1 A
A2 A
A3 A
A4
A5
A6

After formatin
No1 No
A
A2 A
A
A4 A
A
A6 A

Thank
Poga
 
Pogas,

You might be better off using a VLOOKUP function to lookup your values.

If not, then this procedure should work.

Sub test()
Dim i As Long, lngLastRow As Long

With Sheet1
lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To lngLastRow
If .Cells(i, 1).Value <> .Cells(i, 2).Value Then .Cells(i,
2).Insert xlShiftDown
Next
End With
End Sub


Rob


Pogas said:
Dear all,
I am a newbie,and looking urgently for help.Any comments will be appreciated
I have two columns in a spreadsheets as below.I want to match these two
columns and insert a blank cell in column No2 where the two values in the
cells dont match.For example I want to insert a blank cell in column before
A2 in No2 and one blank cell after A2 to match A3 etc .How do I go about
this??
 
Back
Top