Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default does range value exist in another range

is there a simple macro i can run to determine if the value in range("B5")
exists anywhere in range("A1:A10").
similar to the excel function
=MATCH(B5, A1:A10,0)
TIA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default does range value exist in another range

You could use FIND
or just
application.match(range("b5"),range(a1:a10),0)

--
Don Guillett
SalesAid Software

"Spencer" wrote in message
...
is there a simple macro i can run to determine if the value in range("B5")
exists anywhere in range("A1:A10").
similar to the excel function
=MATCH(B5, A1:A10,0)
TIA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default does range value exist in another range

Sub Macro1()
Range("C5").FormulaR1C1 = _
"=MATCH(RC[-1], R[-4]C[-2]:R[5]C[-2],0)"
If IsNumeric(Range("C5").Value) Then
MsgBox "Found"
Else
MsgBox "Not found"
End If
End Sub

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default does range value exist in another range

i don't want to enter a formula in a cell, i want to return the value
true/false back to a variable called "VARIABLE". True being the value in B5
was found in column A, or False meaning it was not.

"merjet" wrote:

Sub Macro1()
Range("C5").FormulaR1C1 = _
"=MATCH(RC[-1], R[-4]C[-2]:R[5]C[-2],0)"
If IsNumeric(Range("C5").Value) Then
MsgBox "Found"
Else
MsgBox "Not found"
End If
End Sub

Hth,
Merjet



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default does range value exist in another range

Dim Variable as Boolean, res as Variant
res = application.match(range("b5"),range("a1:a10"),0)
variable = not iserror(res)

--
Regards,
Tom Ogilvy


"Spencer" wrote:

i don't want to enter a formula in a cell, i want to return the value
true/false back to a variable called "VARIABLE". True being the value in B5
was found in column A, or False meaning it was not.

"merjet" wrote:

Sub Macro1()
Range("C5").FormulaR1C1 = _
"=MATCH(RC[-1], R[-4]C[-2]:R[5]C[-2],0)"
If IsNumeric(Range("C5").Value) Then
MsgBox "Found"
Else
MsgBox "Not found"
End If
End Sub

Hth,
Merjet





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default does range value exist in another range

Sub Macro1()
Dim VARIABLE As Boolean
x = Application.Match(Range("A5"), Range("A1:A10"), 0)
If TypeName(x) < "Error" Then VARIABLE = True
End Sub

Hth,
Merjet


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does a number exist in a range John[_9_] Excel Worksheet Functions 3 July 6th 07 02:52 AM
Help - Does value exist in range of CLOSED workbook? c mateland Excel Worksheet Functions 9 April 16th 07 06:53 PM
Does specific value exist in a range coloradoprof Excel Worksheet Functions 3 November 25th 06 07:00 PM
range name does not exist scory Excel Discussion (Misc queries) 1 September 12th 06 01:17 PM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM


All times are GMT +1. The time now is 05:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"