ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find Macro (https://www.excelbanter.com/excel-discussion-misc-queries/122193-find-macro.html)

Susana C via OfficeKB.com

Find Macro
 
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!

--
Message posted via http://www.officekb.com


Don Guillett

Find Macro
 
This might be easier.

Sub findvalue()
ans = InputBox("Search for?")
Columns(1).Find(ans).Select
End Sub

--
Don Guillett
SalesAid Software

"Susana C via OfficeKB.com" <u21183@uwe wrote in message
news:6a9b9915c300f@uwe...
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!

--
Message posted via
http://www.officekb.com




Susana C via OfficeKB.com

Find Macro
 
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?

Don Guillett wrote:
This might be easier.

Sub findvalue()
ans = InputBox("Search for?")
Columns(1).Find(ans).Select
End Sub

Hello,

[quoted text clipped - 8 lines]

Thanks for any help!


--
Message posted via http://www.officekb.com


Susana C via OfficeKB.com

Find Macro
 
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 C wrote:
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!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


Don Guillett

Find Macro
 
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

"Susana C via OfficeKB.com" <u21183@uwe wrote in message
news:6a9bf0d77dff3@uwe...
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 C wrote:
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!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1




Don Guillett

Find Macro
 
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

"Susana C via OfficeKB.com" <u21183@uwe wrote in message
news:6a9be52398340@uwe...
Thank you. This does close the dialogue box; is there a way to make it
hightlight/ select the whole row?

Don Guillett wrote:
This might be easier.

Sub findvalue()
ans = InputBox("Search for?")
Columns(1).Find(ans).Select
End Sub

Hello,

[quoted text clipped - 8 lines]

Thanks for any help!


--
Message posted via
http://www.officekb.com




Dave Peterson

Find Macro
 
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" wrote:

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 C wrote:
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!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


--

Dave Peterson

Susana C via OfficeKB.com

Find Macro
 
Thanks Don! You're the best!

Don Guillett wrote:
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!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


Don Guillett

Find Macro
 
Glad to help

--
Don Guillett
SalesAid Software

"Susana C via OfficeKB.com" <u21183@uwe wrote in message
news:6a9c2506ea6c9@uwe...
Thanks Don! You're the best!

Don Guillett wrote:
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!


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1





All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com