How do i get the Find method to programmically return whether it found the
specified value or not?
--
Trent Argante
[DC.J(455)]
How do i get the Find method to programmically return whether it found the
specified value or not?
--
Trent Argante
[DC.J(455)]
Try something like
Dim FoundCell As Range
Set FoundCell = Range(your_range).Find(what:="abc")
If Not FoundCell Is Nothing Then
Debug.Print "Found: " & FoundCell.Address
Else
Debug.Print "Not Found."
End If
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Trent Argante" <TrentArgante@discussions.microsoft.com> wrote in
message
news:1E59C444-8F26-4F4B-8C98-8D6F2FB8143C@microsoft.com...
> How do i get the Find method to programmically return whether
> it found the
> specified value or not?
> --
> Trent Argante
> [DC.J(455)]
For the find you have specified the What. Depending what you are looking for
(text or number) you should probably specify, LookAt (xlWhole, xlPart),
LookIn (xlformula, xlValues), MatchCase (true or false). Excel uses the last
setting that was used for a Find, which may or may not be what you want.
I have never had any luck determining the setting before doing the find
(Chip if there is a way I would love to know what it is.) so you may need to
modify these settings.
--
HTH...
Jim Thomlinson
"Chip Pearson" wrote:
> Try something like
>
> Dim FoundCell As Range
> Set FoundCell = Range(your_range).Find(what:="abc")
> If Not FoundCell Is Nothing Then
> Debug.Print "Found: " & FoundCell.Address
> Else
> Debug.Print "Not Found."
> End If
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
> "Trent Argante" <TrentArgante@discussions.microsoft.com> wrote in
> message
> news:1E59C444-8F26-4F4B-8C98-8D6F2FB8143C@microsoft.com...
> > How do i get the Find method to programmically return whether
> > it found the
> > specified value or not?
> > --
> > Trent Argante
> > [DC.J(455)]
>
>
>
Chip & Jim,
Thank you, both, for your help. The code is running quite well now.
--
Trent Argante
[DC.J(455)]
"Jim Thomlinson" wrote:
> For the find you have specified the What. Depending what you are looking for
> (text or number) you should probably specify, LookAt (xlWhole, xlPart),
> LookIn (xlformula, xlValues), MatchCase (true or false). Excel uses the last
> setting that was used for a Find, which may or may not be what you want.
>
> I have never had any luck determining the setting before doing the find
> (Chip if there is a way I would love to know what it is.) so you may need to
> modify these settings.
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Chip Pearson" wrote:
>
> > Try something like
> >
> > Dim FoundCell As Range
> > Set FoundCell = Range(your_range).Find(what:="abc")
> > If Not FoundCell Is Nothing Then
> > Debug.Print "Found: " & FoundCell.Address
> > Else
> > Debug.Print "Not Found."
> > End If
> >
> >
> > --
> > Cordially,
> > Chip Pearson
> > Microsoft MVP - Excel
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> >
> >
> > "Trent Argante" <TrentArgante@discussions.microsoft.com> wrote in
> > message
> > news:1E59C444-8F26-4F4B-8C98-8D6F2FB8143C@microsoft.com...
> > > How do i get the Find method to programmically return whether
> > > it found the
> > > specified value or not?
> > > --
> > > Trent Argante
> > > [DC.J(455)]
> >
> >
> >
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks