I've got the code working fairly well, but for
some reason it sometimes highlights the blank cell after the last cell
containing data. For example, StartRow is 2, and cells A2:A5 have data in them,
but sometimes cell A6 is highlighted. Any idea what I've done wrong? My code
is as follows:
****************************************************************
Sub HighlightRandomCell()
Columns(1).Interior.ColorIndex = 0
StartRow = 2RowCnt = Application.WorksheetFunction.CountA(Range("A" & StartRow &
":A65000"))
randrow = Int((RowCnt + 1) * Rnd) + StartRow
Cells(randrow, 1).SelectCells(randrow, 1).Interior.ColorIndex = 6
End Sub
****************************************************************