J
Janis
This code works but the division should always give an even number. I'm
trying to error check for an accidental odd number of rows in the
irwo(service group column). The code should continue but give an error
message. There are 2 lines in the code that have division and they should
both be even quotients. Should I put the resume Next on both lines for it to
error check for both lines? The other question is if both numbers are
integers when they divide what would be the function to get it to throw an
error if it is not an even division?
tia,
-----section of code---------
For iRow = LastRow To FirstDataRow Step -1
i = i + 1
If .Cells(iRow, ServiceGroupColumn).Value = .Cells(iRow - 1,
ServiceGroupColumn).Value Then
Else
On Error Resume Next
rowsToAdd = (40 - i) / 2
.Cells(iRow, ServiceGroupColumn).Offset(i /
2).Resize(rowsToAdd).EntireRow.Insert
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical
End If
i = 1
End If
Next iRow
End With
End Sub
trying to error check for an accidental odd number of rows in the
irwo(service group column). The code should continue but give an error
message. There are 2 lines in the code that have division and they should
both be even quotients. Should I put the resume Next on both lines for it to
error check for both lines? The other question is if both numbers are
integers when they divide what would be the function to get it to throw an
error if it is not an even division?
tia,
-----section of code---------
For iRow = LastRow To FirstDataRow Step -1
i = i + 1
If .Cells(iRow, ServiceGroupColumn).Value = .Cells(iRow - 1,
ServiceGroupColumn).Value Then
Else
On Error Resume Next
rowsToAdd = (40 - i) / 2
.Cells(iRow, ServiceGroupColumn).Offset(i /
2).Resize(rowsToAdd).EntireRow.Insert
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical
End If
i = 1
End If
Next iRow
End With
End Sub