Originally Posted by
mgs73
Ok, so your worksheet is empty...? What do you want it to look like after the macro is run?
Try this:
r = Cells(Rows.Count, 1).End(xlUp).Row
If Cells(r, 1).Value <> vbNullString Then r = r + 1
Cells(r, 1).Value = Name
Cells(r, 2).Value = score
Cells(r, 3).Value = grade
Nice. Can you explain the syntax and how it works?
What I want is for the three cells to be populated once an open cell is found.
I came up with this:
'For i = 1 To 10
' If IsEmpty(Cells(i, 1)) And IsEmpty(Cells(i, 2)) And IsEmpty(Cells(i, 3)) Then
' Cells(i, 1).Value = name
' Cells(i, 2).Value = score
' Cells(i, 3).Value = grade
' Exit For
' End If
'Next i
'
'If i = 11 Then
' MsgBox ("No further room available.")
'End If
I kept it to the first 10 rows after you and TMS pointed out a million rows, etc. The problem with
mine is the limitation, though, since the spreadsheet may have occupied cells there. I added the
last MsgBox in that case (and it was instructive as it occurs when i = 11, not 10).
Bookmarks