ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Find (https://www.excelbanter.com/excel-programming/368683-dynamic-find.html)

T De Villiers[_62_]

Dynamic Find
 

In A1 I have value "taz" (this will change according to user)

I would now like to find "taz" (or alt value entered by user) within
the sheet

My code isnt quite working:

Cells.Find (Range("A1"))


Thanks for any help


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566092


Tom Ogilvy

Dynamic Find
 
Dim rng as Range
set rng = Cells.Find(What:=Range("A1"), _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if rng.Address = "$A$1" then
msgbox "Not found"
else
rng.Select
End if

--
Regards,
Tom Ogilvy


"T De Villiers" wrote:


In A1 I have value "taz" (this will change according to user)

I would now like to find "taz" (or alt value entered by user) within
the sheet

My code isnt quite working:

Cells.Find (Range("A1"))


Thanks for any help


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566092



Les

Dynamic Find
 
To find a single entry try something like:

Dim x As Range

Set x = Cells.Find(Range("A1"))
If x.Address = "$A$1" Then
MsgBox "Not found"
Else
MsgBox "Found at " & x.Address
End If

--
Les Torchia-Wells


"T De Villiers" wrote:


In A1 I have value "taz" (this will change according to user)

I would now like to find "taz" (or alt value entered by user) within
the sheet

My code isnt quite working:

Cells.Find (Range("A1"))


Thanks for any help


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566092



Tom Ogilvy

Dynamic Find
 
It think if you don't specify the after argument as cell A1, your macro would
give spotty results. Just a thought.

--
Regards,
Tom Ogilvy


"Les" wrote:

To find a single entry try something like:

Dim x As Range

Set x = Cells.Find(Range("A1"))
If x.Address = "$A$1" Then
MsgBox "Not found"
Else
MsgBox "Found at " & x.Address
End If

--
Les Torchia-Wells


"T De Villiers" wrote:


In A1 I have value "taz" (this will change according to user)

I would now like to find "taz" (or alt value entered by user) within
the sheet

My code isnt quite working:

Cells.Find (Range("A1"))


Thanks for any help


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566092



Les

Dynamic Find
 
Of course, you are absoluely correct. I should take more care in my postings.
'Tis just my second day at this and I'm learning protocol as I go.
--
Les Torchia-Wells


"Tom Ogilvy" wrote:

It think if you don't specify the after argument as cell A1, your macro would
give spotty results. Just a thought.

--
Regards,
Tom Ogilvy


"Les" wrote:

To find a single entry try something like:

Dim x As Range

Set x = Cells.Find(Range("A1"))
If x.Address = "$A$1" Then
MsgBox "Not found"
Else
MsgBox "Found at " & x.Address
End If

--
Les Torchia-Wells


"T De Villiers" wrote:


In A1 I have value "taz" (this will change according to user)

I would now like to find "taz" (or alt value entered by user) within
the sheet

My code isnt quite working:

Cells.Find (Range("A1"))


Thanks for any help


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566092




All times are GMT +1. The time now is 03:25 AM.

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