View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jazz Jazz is offline
external usenet poster
 
Posts: 45
Default Insert Row and calculate difference between two dates

I am looking to insert a row above each row with contents starting in Row 2.
Minus the date in Column C for each row with contents from todays date and
put the difference in Column A the empty row above. Here is what I am
starting with.

Dim lngRow As Long, blnInsert As Boolean
lngRow = 2
Do While lngRow <= Cells(Rows.Count, "G").End(xlUp).Row
blnInsert = Not blnInsert
If blnInsert Then
Rows(lngRow).Insert
Range("A" & lngRow) = Date - Range("G" & lngRow + 1)
End If
lngRow = lngRow + 1
Loop

I would like to add to this code so that it will also minus the date in
Column H for each row with contents from todays date and put the difference
in Column D the empty row above. Can you help?