Information Required on Insertion of series

A

Akash

I have a series of numbers

1234
1236
1239
1240
1243
1245


now i want that a row should get inserted autometically if the series
is not in line

like
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245

More over i want that the text of the new Inserted row should be in
red color.

Is it possible.

Thanks in Advance

Regards

Akash
 
J

JE McGimpsey

One way:

Public Sub Fill_in_red()
Dim i As Long
Dim dTemp As Double
With Sheets(1).Columns(1)
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 2 Step -1
dTemp = .Cells(i).Value - 1
Do Until dTemp <= .Cells(i - 1).Value
.Cells(i).EntireRow.Insert Shift:=xlShiftDown
.Cells(i).Value = dTemp
.Cells(i).Font.ColorIndex = 3
dTemp = dTemp - 1
Loop
Next i
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top