this is mad...
am trying to write a function to return the first cell
in a filtered list...
but while developing it I came across this problem...
these two pieces of code are exactly the same, except one is in a
function... you'll noticed ive commented the line out that 'should' return the second SpecialCells(xlCellTypeVisible) and should return the result a want.
The problem is...
the subroutine debug.print returns all my filtered cells, the function debug.print returns everything!!
any clues whats happening???
Function fRow() As String
a = 0
For Each c In
Sheets(1).AutoFilter.Range.SpecialCells(xlCellTypeVisible)
a = a + 1
'If a = 2 Then fRow = c.Value
Debug.Print c.Value
Next
End Function
'------------------------------------
Sub fRow2()
a = 0
For Each c In
Sheets(1).AutoFilter.Range.SpecialCells(xlCellTypeVisible)
a = a + 1
'If a = 2 Then fRow = c.Value
Debug.Print c.Value
Next
End Sub

in a filtered list...
but while developing it I came across this problem...
these two pieces of code are exactly the same, except one is in a
function... you'll noticed ive commented the line out that 'should' return the second SpecialCells(xlCellTypeVisible) and should return the result a want.
The problem is...
the subroutine debug.print returns all my filtered cells, the function debug.print returns everything!!
any clues whats happening???
Function fRow() As String
a = 0
For Each c In
Sheets(1).AutoFilter.Range.SpecialCells(xlCellTypeVisible)
a = a + 1
'If a = 2 Then fRow = c.Value
Debug.Print c.Value
Next
End Function
'------------------------------------
Sub fRow2()
a = 0
For Each c In
Sheets(1).AutoFilter.Range.SpecialCells(xlCellTypeVisible)
a = a + 1
'If a = 2 Then fRow = c.Value
Debug.Print c.Value
Next
End Sub