Value of next visible mycell within a rng
Maybe you could pick up the values in the visible cells and plop them into an
array and then use that array:
Option Explicit
Sub testme()
Dim myRng As Range
Dim iCtr As Long
Dim myVal() As Variant
Dim myCell As Range
Set myRng = ActiveSheet.Range("a1:a20") _
.Cells.SpecialCells(xlCellTypeVisible)
ReDim myVal(1 To myRng.Cells.Count)
iCtr = 1
For Each myCell In myRng.Cells
myVal(iCtr) = myCell.Value
iCtr = iCtr + 1
Next myCell
End Sub
Rasmus wrote:
"Dave Peterson" wrote in message
...
Ps. Thanks for the correction!
Dave Peterson
Thanks for the routine - It did the job.
However, I was looking for a build-in function in Excel that could simply
tell me what the next cell within the defined range would be (as Excel MUST
know). I realise that your fine routine does this, but it eats up a lot of
CPU time if you use through a 40.000+ rows sheet.
But it did the job, so thanks again. I learned something as well.
Rasmus
--
Dave Peterson
|