finding things

susbrat

New Member
Joined
May 13, 2011
Messages
1
Hi.
Is there a way of setting the "find" function to search from the bottom of the sheet to the top, hence searching the more recent entries first?
Cheers.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi and welcome.

Assume you're talking about the VBA Find method?

I tend to use this sort of construction:
Code:
Sub FindMe()
Dim rngLook As Range, rngFound As Range
Set rngLook = Sheet1.Range("A1:E10")
On Error Resume Next
Set rngFound = rngLook.Find(What:="MyString", After:=rngLook.Cells(rngLook.Cells.Count), LookIn:=xlValues, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:= _
        False, SearchFormat:=False)
If Not rngFound Is Nothing Then
    MsgBox rngFound.Address
End If
End Sub
 
Last edited:
Upvote 0
Code:
Sub S1()

    Dim rng As Range
    
    Set rng = Sheet1.Cells.Find(What:="What", SearchDirection:=xlPrevious)

End Sub
 
Upvote 0
Think this does it
Code:
Sub FindMe()
Dim rngLook As Range, rngFound As Range
Set rngLook = Sheet1.Range("A1:E10")
On Error Resume Next
Set rngFound = rngLook.Find(What:="MyString", After:=rngLook.Cells(rngLook.Cells.Count - 1), LookIn:=xlValues, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:= _
        False, SearchFormat:=False)
If Not rngFound Is Nothing Then
    MsgBox rngFound.Address
End If
End Sub
 
Upvote 0
You could specify a search direction in the older versions, but this nice feature is gone in 2010... wow! It could be built as a macro feature because this is possible in VBA:

Cells.Find(What:="searchtext", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False).Activate

I can't believe they left this off of the dialog box... I'm stunned.

it would not be hard to create your own dialog box and use the xlPrevious search direction. This will be put back in sometime...they will get complaints.
 
Upvote 0

Forum statistics

Threads
1,224,614
Messages
6,179,906
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top