-
Solved: How do we test for a filtered row in vba
I do a lot of work with filters and would like to run macros where I highlight something I have filtered and run a "for each" loop against each cell in the highlighted area. This works well except that when some rows are hidden by the filter and they are included in the range, then the macro is applied to them as well. Does anyone have any ideas about how I can test for this. Here is a sample code that I use.
Sub calcrange()
TargetRange = Selection.Address
For Each cell In Range(TargetRange)
cell.Calculate
Next
End Sub
-
Hi
how about
[vba]
Sub calcrange()
set TargetRange = Selection.SpecialCells(xlCellTypeVisible)
For Each ce In TargetRange
cell.Calculate
Next TargetRange
End Sub
[/vba]
Tony
-
Thanks, that was perfect. Will save me minutes!!! but often.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules