View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Compare values of cells in a range

On Dec 14, 2:18 pm, Dale Fye wrote:
I want to compare the values of cells in a range, without actually selecting
the range. If so, what is the proper syntax? BTW, the sheet that the range
is on is hidden.

Private Function fnCompCells(rng as Range) as String

For each cell in rng
Dim myValue as string
If cell.value .....
'insert some comparison code here
endif
Next
fnCompCells = myValue
End
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.


Hi
Not quite sure what you want, but you would use this function like:

Set myRange = Worksheets("MyHiddenSheet").Range("A2:C10")
myString = fnCompCells(myRange)

regards
Paul