View Single Post
 
Old 06-22-2022, 04:04 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,057
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

If you use the selection object it isn't too complex.
Code:
Sub GetUp()
  Dim aCell As Cell, aRng As Range
  Set aRng = Selection.Range
  Selection.Range.Cells(1).Select
  Selection.MoveUp
  If Selection.Range.Cells.Count = 1 Then
    Debug.Print Selection.Range.Cells(1).Range.Text
  Else
    Debug.Print "No cells immediately above selection"
  End If
  aRng.Select  'restore selection
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote