View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ksp ksp is offline
external usenet poster
 
Posts: 1
Default Help With Insert Row Macro


I need some help with a macro to insert one row at a point where there
is text in a particular column.

The worksheet has multiple columns, but the two relevant ones are
headed Category (Column A) and Tasks (Column D). Each Category
description has at least one task, but can have up to 20. I have been
using the macro below to insert one row before each new category.
However, what I have discovered is that this is actual inserting one
row after the category description. This is fine as long as there is
only ever one task, but this is not the case.

Everything that I have tried so far seems to only cause the macro to go
into a loop

Any input / help would be appreciated

Thanks

Karen

Sub InsertRows()
With Range("A10:A2498")
On Error Resume Next
Set C = .Find(What:="*", LookIn:=xlValues)
If Not C Is Nothing Then
firstAddress = C.Address
Do
C.Offset(1, 0).EntireRow.Insert
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address < firstAddress
End If
End With
End Sub


--
ksp
------------------------------------------------------------------------
ksp's Profile: http://www.excelforum.com/member.php...fo&userid=6267
View this thread: http://www.excelforum.com/showthread...hreadid=502787