View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Urgent-formating of columns

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" wrote in message
...
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??
No1 No2
A1 A2
A2 A4
A3 A6
A4
A5
A6


After formating
No1 No2
A1
A2 A2
A3
A4 A4
A5
A6 A6

Thanks
Pogas