Looping code
Hi Rob,
Not really sure that I understand the question correctly.
I interpretted as the loop to be after the form is closed. Is this correct?
When you say empty row, do you mean the entire row because that is how I
interpreted?
CountA counts the number of cells that are NOT empty in the row therefore if
it returns zero then the row is empty.
Sub CheckVolumeRise()
Dim lngCol As Long
Dim lngRow As Long
If ActiveCell < ActiveCell.Offset(0, 2) And _
ActiveCell.Offset(0, 2) < ActiveCell.Offset(0, 4) Then
Selection.End(xlToLeft).Select
CriteriaReached.Show
'following code will not run until
'after the form is closed.
Selection.End(xlToRight).Select
ActiveCell.Offset(1, -4).Activate
lngCol = ActiveCell.Column
For lngRow = ActiveCell.Row To Rows.Count
If WorksheetFunction.CountA _
(Cells(lngRow, lngCol).EntireRow) = 0 Then
MsgBox "Row " & lngRow & " Is empty."
Exit For 'Don't go any further
End If
Next lngRow
Else
ActiveCell.Offset(1, 0).Activate
End If
End Sub
--
Regards,
OssieMac
|