Comparing a range with text

  • Thread starter Thread starter Frood
  • Start date Start date
F

Frood

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top