H
Horatio J. Bilge, Jr.
I am trying to write a macro that will check the last cell in each row of a
range against a condition. If the condition is met, then the value of the
first cell in the row is added to a string. The string will be used for a
message box.
The range("A342") has names in the first column, data in the middle
columns, and totals in the last column. I'm trying to use a for-next loop,
but I'm stuck on how to refer to the correct cell. This is what I have tried:
Private Sub cmdErrorCheck_Click()
Dim e As String
For Each .Row In Me.Range("A342")
If [the last cell].Value > 4 Then
e = e & [the first cell].Value
End If
Next .Row
MsgBox "There is an error on these people: " & e
End Sub
range against a condition. If the condition is met, then the value of the
first cell in the row is added to a string. The string will be used for a
message box.
The range("A342") has names in the first column, data in the middle
columns, and totals in the last column. I'm trying to use a for-next loop,
but I'm stuck on how to refer to the correct cell. This is what I have tried:
Private Sub cmdErrorCheck_Click()
Dim e As String
For Each .Row In Me.Range("A342")
If [the last cell].Value > 4 Then
e = e & [the first cell].Value
End If
Next .Row
MsgBox "There is an error on these people: " & e
End Sub