View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default how do i compare values line by line??

Sub AddBlankLines()
Set rng = Range("A3")
Do
If rng.Value < rng.Offset(-1, 0).Value Then
rng.EntireRow.Insert
End If
Set rng = rng.Offset(1, 0)
Loop Until IsEmpty(rng)
End Sub

--
Regards,
Tom Ogilvy




projectside wrote in message
...
Help:

I need to compare values line by line. The scenario is like this:
If A3.value = A2.value, go to next line and do another comparison
until next line is not equal to prev line's value.

but if A3.value not equal A2.value, insert a blank line in between. I
need to loop this until I get to a line where there is no value.

the number of line is NOT pre-determined.

can anybody help?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/