MrExcel Publishing
Your One Stop for Excel Tips & Solutions

adding a row after a certain word


Posted by mozzy on August 16, 2001 8:45 AM

is it possible to add a row after a cretain word? either with an if statement or a visual basic code?


Posted by neo on August 16, 2001 9:02 AM

i just modified my code from the 'delete rows' post below. try this :

Private Sub RemoveRows()
Dim lastrow As Integer
lastrow = 10 'set this number to the last row in your worksheet...

Range("a1").Select 'starting cell & column where the word should appear...
Do Until ActiveCell.Row > lastrow
If ActiveCell.Value = "hello" Then
ActiveCell.EntireRow.Offset(1, 0).Insert
ActiveCell.Offset(2, 0).Select
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop

end sub

neo

Posted by ~Rob on August 16, 2001 9:02 AM

Try ASAP Utilities. It is a free download that someone here referred me to about a month ago. It has saved me hours of work!

http://www.asap-utilities.com/