This tests a date in cloumn A to see if is a Sunday and then inserts a row.
Adjust to suit your needs
HTH
Sub InsertRow()
With Worksheets("Sheet1") ' <=== change as required
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For r = lastrow To 2 Step -1
If Weekday(.Cells(r, "A"),2) = 7 Then ' <== change test to suit
your needs
.Cells(r, "A").Offset(1, 0).EntireRow.Insert
End If
Next r
End With
End Sub
"RSantos" wrote:
HI,
I would like to insert a row when a certain cell has a certain value.
The ideia is to divide the values into weeks, inserting an empty row
after every sunday (where I wiil put the totals of the week), and group
the whole week in order to see just the week total.
Can anyone help me doing this in VBA?
--
RSantos
------------------------------------------------------------------------
RSantos's Profile: http://www.excelforum.com/member.php...o&userid=31240
View this thread: http://www.excelforum.com/showthread...hreadid=516687