View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Comparing a range with text

Hi
try somthing like
sub foo()
dim rng as range
dim cell as range
set rng = Range("Text_range")
for each cell in rng
if cell.value="your_test_value" then
msgbox "Found value in cell: " cell.address
end if
next
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


Frood wrote:
Hello all,

I hope someboy can help with this, I have defined a name (Text_range)
for a range of cells.
I would like to write a macro that compares all cells in the range
with a string.

The reason I want to refer to the defined name for the cells is
because the range is not continuous
(=Results!$A$16:$A$84,Results!$A$86:$A$241...etc).

Any help would be much appreciated.

Ray