PDA

View Full Version : Solved: Working with Filtered Data



vzachin
01-16-2007, 08:01 AM
hi,

i asked this question in the past and now i need to revisit this.
Basically, i want to only work with filtered information in my worksheet.
if i don't filter, the following code works correctly, but if i apply a filter it does not.
i've tried a previous solution with .visible property, but i couldn't get it to work correctly.
here's my code:

Sub filtered()
For i = 5 To 65536
If Range("C" & i).FormulaR1C1 = "" Then
Exit Sub
ElseIf Not Sheets("AREAS").Rows(i).Hidden Then '<---i added this thinking this would work, but it doesn't
End If
Location = Range("C" & i)
Division = Range("D" & i)
Unit = Range("E" & i)
Next i

End Sub


My previous solution was to copy the filtered information into another worksheet and then continue with the macro.

can anybody help?

thanks
zach

mdmackillop
01-16-2007, 12:40 PM
Hi zach,
This is marked solved. Is that intentional?
try
Sub filtered()
Dim cel As Range
For Each cel In Range(Cells(5, 3), Cells(Rows.Count, 3).End(xlUp))
If cel.RowHeight > 0 Then
Location = cel
division = cel.Offset(, 1)
unit = cel.Offset(, 2)
msg = Location & vbCr & division & vbCr & unit
MsgBox msg
End If
Next

End Sub