Date: Mon, 10 Dec 2007 10:26:42 -0600 (CST) From: Mark Jacobson To: 810-022-01-fall@uni.edu Subject: [810-022-01-FALL] Finding first available row for the summary line... Hi 022 students, Two students have had a problem with bugs (slimers or errors) in the macro code to update the summary row. The solution is to just have an IF THEN statement and an example of how to do this is shown below. Mark ' This macro solves the problem of finding the first empty ' row to put a birthday or dice throwing or free throw ' summary. It does not matter if cell G1 has anything in it or not. ' ' G H I Merge and center ' 1 Add some numbers experiment <------- across G, H and I ' 2 die 1 die 2 die sum ' 3 <------- goes to cell G3 ' 4 ' It does not matter if cell G3 is empty or if cell G3 has ' some data in it from a previous summary. The IF statement ' takes care of the problem for when its the first time ' after the Contents have been Cleared for summary rows. ' die 1 <--- is the label in cell G2 Sub FindFirstEmptyRow() Range("G2").Select If ActiveCell.Offset(1, 0).Value <> "" Then Selection.End(xlDown).Select End If ActiveCell.Offset(1, 0).Range("A1").Select End Sub ' G H I Merge and center ' 1 Add some numbers experiment <------- across G, H and I ' 2 die 1 die 2 die sum ' 3 <------- goes to cell G3 ' 4 ' G H I ' 1 Add some numbers experiment ' 2 die 1 die 2 die sum ' 3 6 2 8 ' 4 1 4 5 ' 5 <------ goes to cell G5