Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equivalent to Selection.End(XLUp).select

Status
Not open for further replies.

dar149

MIS
Mar 5, 2002
117
US
I am looking for an equivalent to Selection.End(XLUp).Select. I need to move to the very top row of a column, but there may or may not be data in every cell, so the above code doesn't work. I never know what column they are in, so I need to code to move up relatively. I could use activecell.offset, but I need some way to make it stop without receiving an error.

Any suggestions??
Thanks,
Debbie
 
Hi
This will select the first cell in the active column containing data

Code:
Sub s()
Dim lRow As Long
    lRow = ActiveSheet.Columns(ActiveCell.Column).Cells.Find(What:="*", _
      after:=Cells(65536, ActiveCell.Column), SearchDirection:=xlNext, SearchOrder:=xlByRows).Row
Cells(lRow, ActiveCell.Column).Select
End Sub

This will select the first row in the active column

Code:
Cells(1, ActiveCell.Column).Select

Wasn't sure which you wanted!
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Thanks!! Cells(1, ActiveCell.Column).Select
is exactly what I wanted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top