I'm not sure what should be done if all of column A is filled and there are
no blank cells in it. Since the OP said he wanted the selection to be in
Column A, I guess selecting A1 is as good a solution as any for this
situation. Although this situation would come up quite rarely I would
assume; and, if A1 wasn't acceptable, code could easily be added to select
some other cell. I'm curious as to what cell you would select for it?
The second case you mentioned was an oversight in my code and easily
accounted for...
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim LastCell As Range
Set LastCell = Sh.Cells(Sh.Rows.Count, "A").End(xlUp)
On Error GoTo Whoops
Sh.Range("A1:A" & LastCell.Row).Find("", After:=LastCell, _
SearchOrder:=xlByRows).Select
Exit Sub
Whoops:
If LastCell.Row = 1 And LastCell.Value = "" Then
Range("A1").Select
Else
LastCell.Offset(1).Select
End If
End Sub
For single cell selection, there doesn't seem to be any real difference
between using Select or Activate. Note that I changed the Activate Method
calls from my other posting to Select Method calls in the code above.
--
Rick (MVP - Excel)
Ronald R. Dodge said:
That still doesn't work for the following 2 cases:
If every single cell in column A is filled as A1 will be selected
If only A1 has something in it, A1 will still be selected.
Also, even though Activate is valid to use, from what I have read, Select
is the preferred method for when selected either a single cell or a range.
--
Thanks,
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000