ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   One more request on row insertion. (https://www.excelbanter.com/excel-programming/385697-one-more-request-row-insertion.html)

[email protected]

One more request on row insertion.
 
I'm about to take off on maternity leave in 8 days and I appreciate
all the help on this.

With the help of a couple programmers.

I've managed to get this - It works fine only the rows do not insert
properly after the first set. The background color changes over the
data and not adding a new row. I've uploaded an image example.

http://bp1.blogger.com/_0XguicNvp2w/...-h/example.bmp

Thanks again for all the efforts.


Option Explicit
Dim MyCell, MyRng As Range
Dim i As Integer


Private Sub CommandButton1_Click()
Set MyRng = [a1:a65000]
For Each MyCell In MyRng
If InStr(MyCell.Value, "Total") 0 Then
MyCell.Offset(1, 0).Select
Do While i < 4
ActiveCell.EntireRow.Insert
i = i + 1
Loop
ActiveCell.Value = "Avails"
ActiveCell.EntireRow.Interior.ColorIndex = 5
ActiveCell.Offset(1, 0).Value = "Left"
ActiveCell.Offset(1, 0).EntireRow.Interior.ColorIndex = 6
End If
Next MyCell
i = 0
End Sub


[email protected]

One more request on row insertion.
 
THANKS STEVE & PAUL for your help on this!!!!

With your help I've got it to work..

Please, disregard this request.

Regards, Gwen



All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com