View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Calculating Only Visiable Data

Glad to help. Subtotal is better but you asked for VBA

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"paddy_nyr" wrote in message
reenews.net...
"Don Guillett" wrote in message
...
Sub avervisible()
mysum = 0
On Error Resume Next
For Each c In Range("a1:a" & Cells(Rows.Count, "a").End(xlUp).Row)
If c.EntireRow.Hidden < True Then
mysum = mysum + c.Value
mc = mc + 1
End If
Next
MsgBox mysum
MsgBox mc
MsgBox mysum / mc
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"paddy_nyr" wrote in message

Thanks Don that did it.