ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   determine if value exists (https://www.excelbanter.com/excel-programming/373274-determine-if-value-exists.html)

Geebee

determine if value exists
 
hi,

I am trying write code to determine if a specific value, lets say "DOODLE"
exists within a specified range in an excel sheet. The range specified could
be J12:J88 for example.

Thanks in advance,
geebee


Die_Another_Day

determine if value exists
 
With Code or a function?
code:
Dim SearchCell As Range
Set SearchCell = Range("J12:J88").Find(What:="DOODLE",LookAt:=xlWho le)
If SearchCell Is Nothing Then
MsgBox "DOODLE Does Not Exist in Range J12:J88"
End If

Function:
If(Iserror(Match("DOODLE",J12:J88,0)),"Not There","Found At: J" &
(Row() - 1 + Match("DOODLE",J12:J88,0))

HTH

Charles Chickering

geebee wrote:
hi,

I am trying write code to determine if a specific value, lets say "DOODLE"
exists within a specified range in an excel sheet. The range specified could
be J12:J88 for example.

Thanks in advance,
geebee



Bob Phillips

determine if value exists
 
If Not IsError(Application.Match("DOODLE",Range("J12:J88" ),0)) Then
'value found
Else
'value is not found
End If

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"geebee" wrote in message
...
hi,

I am trying write code to determine if a specific value, lets say "DOODLE"
exists within a specified range in an excel sheet. The range specified

could
be J12:J88 for example.

Thanks in advance,
geebee





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

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