D
dave
As part of my macro i have this block of data where i need to insert 3
lines whenever the contents of column B changes. I have tried various
formats of inserting a calculation, all to no avail, where i have the
string of question marks. Basically i want to insert a formula that
sums up that column from the first row to the last row that has the
same value in column B. the variable firstrow will have the first row
number and the vairlabe i will have last riow number
LastRow = Range(Cells(1, 1), Cells(Rows.Count, 1)).End(xlDown).Row
FirstRow = 4
For i = 4 To LastRow
If Cells(i, 2) <> Cells(i + 1, 2) Then
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 11).Value = "Total"
Cells(i + 1,12) ???????????????
Cells(i + 1, 11).Select
Selection.Font.Bold = True
Cells(i + 2, 11).Value = "AUV Verify"
Cells(i + 2, 11).Select
Selection.Font.Bold = True
Cells(i + 3, 11).Value = "Difference"
Cells(i + 3, 11).Select
Selection.Font.Bold = True
LastRow = LastRow + 3
i = i + 3
FirstRow = i + 1
End If
Next i
lines whenever the contents of column B changes. I have tried various
formats of inserting a calculation, all to no avail, where i have the
string of question marks. Basically i want to insert a formula that
sums up that column from the first row to the last row that has the
same value in column B. the variable firstrow will have the first row
number and the vairlabe i will have last riow number
LastRow = Range(Cells(1, 1), Cells(Rows.Count, 1)).End(xlDown).Row
FirstRow = 4
For i = 4 To LastRow
If Cells(i, 2) <> Cells(i + 1, 2) Then
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 2).EntireRow.Insert
Cells(i + 1, 11).Value = "Total"
Cells(i + 1,12) ???????????????
Cells(i + 1, 11).Select
Selection.Font.Bold = True
Cells(i + 2, 11).Value = "AUV Verify"
Cells(i + 2, 11).Select
Selection.Font.Bold = True
Cells(i + 3, 11).Value = "Difference"
Cells(i + 3, 11).Select
Selection.Font.Bold = True
LastRow = LastRow + 3
i = i + 3
FirstRow = i + 1
End If
Next i