LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Need UDF help; cycling through various sheets using VBA name property

Thanks to Tom, Bob, and Mark for your responses. I had forgotten about the
application.volatile issue, so I went ahead and decided to pass the source
ranges directly. Here's the final product, in case anyone is interested :)
Keith R
XL97
================================================== ======
Public Function Consolidated(SC1 As Range, SC2 As Range, SC3 As Range, _
SC4 As Range, SC5 As Range, SC6 As Range, SC7 As Range) As Variant
'each input range will be a single cell

Dim i As Long
Dim ws As Range
Dim TotalValue As Double
Dim DivCount As Double

For i = 1 To 7
Set ws = (Choose(i, SC1, SC2, SC3, SC4, SC5, SC6, SC7))
If Not IsError(ws.Value) Then
If Not IsEmpty(ws.Value) Then
If IsNumeric(ws.Value) Then
TotalValue = TotalValue + ws.Value
DivCount = DivCount + 1
End If
End If
End If
Next
If DivCount 0 Then
Consolidated = TotalValue / DivCount
Else
Consolidated = CVErr(xlErrNA)
End If

End Function


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab keeps cycling through the same row Mike Excel Discussion (Misc queries) 2 August 14th 08 12:20 AM
Cycling through workbooks Nico Excel Discussion (Misc queries) 4 July 4th 08 10:09 PM
Pivot Table Cycling Through Page Fields Automatically nrehman Excel Discussion (Misc queries) 14 October 13th 05 07:32 PM
Anyone out there knows of running cycling and swimming logs? Tlaloc Excel Discussion (Misc queries) 4 January 21st 05 04:29 AM
.Visible Property Jollynicechap Excel Programming 1 July 8th 03 09:06 PM


All times are GMT +1. The time now is 06:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"