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 If Cell Contents Don't Match, Move All Data Down One Row

Sub FFF()
Dim rng As Range, cell As Range
Set rng = Range(Range("J1"), Range("J1").End(xlDown))
For Each cell In rng
If cell.Offset(0, -1) < cell.Value And Not _
IsEmpty(cell.Offset(0, -1)) Then
Cells(cell.Row, 1).Resize(1, 9).Insert Shift:=xlShiftDown
End If
Next
End Sub


Might be what you want.

--
Regards,
Tom Ogilvy




"DJS" wrote in message
...
Hello,
I am a newbie to VBA and am trying to write a simple script which will
compare to cells (I1 & J1 ro example) and if they do not match then I need

to
grab the contents of the sheet (starting at that row) and move cell ranges

A
thru I down one row. If they match, then I just need to move my cursor

down
to the next cell (I2) and start the copmparison again against J2.

Essentially
I am trying to line up all contents with its respective row. I am sure
someone has had to do this before and maybe someone could help me get

started
or point me in the right direction