Find Macro

  • Thread starter Thread starter Susana C via OfficeKB.com
  • Start date Start date
S

Susana C via OfficeKB.com

Hello,

I've written a simple macro that searches column A for whatever the user
inputs in the find dialogue box. I would like to now close the box and
hightlight or select the found row.

Here's what I have so far:

Columns("A:A").Select
Application.Dialogs(xlDialogFormulaFind).Show

Thanks for any help!
 
This might be easier.

Sub findvalue()
ans = InputBox("Search for?")
Columns(1).Find(ans).Select
End Sub
 
I'm sorry, one more thing also... if it doesn't find what I've entered, can
it return a message to say "Code not found" instead of bringing the debug
editor up?

Thanks again!

Susana said:
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?
This might be easier.
[quoted text clipped - 8 lines]
 
Sub findvalue()
On Error GoTo nono
ans = InputBox("Search for?")
Columns(1).Find(ans).entirerow.Select
Exit Sub
nono:
MsgBox "not found"
Exit Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
Susana C via OfficeKB.com said:
I'm sorry, one more thing also... if it doesn't find what I've entered,
can
it return a message to say "Code not found" instead of bringing the debug
editor up?

Thanks again!

Susana said:
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?
This might be easier.
[quoted text clipped - 8 lines]
Thanks for any help!
 
Sub findvalue()
On Error GoTo nono
ans = InputBox("Search for?")
Columns(1).Find(ans).entire.row.Select
Exit Sub
nono:
MsgBox "not found"
Exit Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
Susana C via OfficeKB.com said:
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?

Don said:
This might be easier.

Sub findvalue()
ans = InputBox("Search for?")
Columns(1).Find(ans).Select
End Sub
[quoted text clipped - 8 lines]
Thanks for any help!
 
Option Explicit
Sub findvalue()
Dim Ans As String
Dim FoundCell As Range
Ans = InputBox("Search for?")
If Trim(Ans) = "" Then
Exit Sub
End If
Set FoundCell = Columns(1).Find(Ans)
If FoundCell Is Nothing Then
MsgBox Ans & " wasn't found"
Else
FoundCell.EntireRow.Select
End If
End Sub


Susana C via OfficeKB.com said:
I'm sorry, one more thing also... if it doesn't find what I've entered, can
it return a message to say "Code not found" instead of bringing the debug
editor up?

Thanks again!

Susana said:
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?
This might be easier.
[quoted text clipped - 8 lines]
Thanks for any help!
 
Thanks Don! You're the best!

Don said:
Sub findvalue()
On Error GoTo nono
ans = InputBox("Search for?")
Columns(1).Find(ans).entirerow.Select
Exit Sub
nono:
MsgBox "not found"
Exit Sub
I'm sorry, one more thing also... if it doesn't find what I've entered,
can
[quoted text clipped - 11 lines]
 
Glad to help

--
Don Guillett
SalesAid Software
(e-mail address removed)
Susana C via OfficeKB.com said:
Thanks Don! You're the best!

Don said:
Sub findvalue()
On Error GoTo nono
ans = InputBox("Search for?")
Columns(1).Find(ans).entirerow.Select
Exit Sub
nono:
MsgBox "not found"
Exit Sub
I'm sorry, one more thing also... if it doesn't find what I've entered,
can
[quoted text clipped - 11 lines]
Thanks for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top