View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default return random value from visible cells

hmmmmm... interesting. i didn't realize it wouldn't work. i will try
it the way you've described.
thanks a lot for your help!!!
:)
susan


On Nov 1, 3:46*pm, shg wrote:
You can't index a multi-area range like that. At the moment, I don't see
how to do this without a loop:

Code:
--------------------
* * * * Dim iRow * *As Long
* Dim rVis * *As Range
* Dim cell * *As Range
* Dim iRnd * *As Long

* Set rVis = ws1.Range("A1", ws1.Range("A1").End(xlDown)).SpecialCells(xlCellTy peVisible)
* iRnd = Int(rVis.Count * Rnd) + 1

* For Each cell In rVis
* iRow = iRow + 1
* If iRow = iRnd Then Exit For
* Next cell

* iRow = cell.Row

--------------------

--
shg
------------------------------------------------------------------------
shg's Profile:http://www.thecodecage.com/forumz/member.php?userid=13
View this thread:http://www.thecodecage.com/forumz/sh...ad.php?t=23642