Hi all, (again!)
I am trying to get the totals of a filtered range, the below (which i
have painstakingly put together with the help of F8) will loop through
the G collumn and keep adding to my textbox until it reaches an empty
cell, The drawback that I am trying to work out is that regardless of
the fact that the screen is showing a filtered list, it carries on
adding the ones not shown on the screen.
The line below which says "If xlCellTypeVisible = False Then" does not
do anything at all, Does anyone know how I can only add the cells that
are shown on screen?
(come to think of it now, I think the first offset should offset to the
next cell shown on screen instead of G2......I forgot that what im
testing with does have an entry on row 2 but if it didnt then that
would be a problem....ooops)
Set rng1 = Range("g1").Offset(1, 0)
rng1.Activate
LOPRtot.Value = ActiveCell.Value
If rng1.Offset(1, 0).Value >= 1 Then
rng1.Offset(1, 0).Activate
LOPRtot.Value = LOPRtot.Value + ActiveCell.Value
ActiveCell.Offset(1, 0).Activate
End If
Do
If ActiveCell.Value >= "" Then
If xlCellTypeVisible = False Then
LOPRtot.Value = LOPRtot.Value + ActiveCell.Value
ActiveCell.Offset(1, 0).Activate
Else
Exit Sub
End If
End If
Loop Until ActiveCell.Value = ""
Bookmarks