View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Teresa Teresa is offline
external usenet poster
 
Posts: 169
Default Creating a Function

Thanks for this but cant get it to work exactly


"Seiya" wrote:

try
Function mmm(rng As Range) As String
Dim numAry, monthAry, i As Long
numAry = Array(1, 2, 3): monthAry = Array("Jan", "Feb", "Mar")
For i = LBound(numAry) To UBound(numAry)
If rng(numAry(i), 1) < "" And _
Application.Sum(rng.Resize(rng.Rows.Count -
numAry(i)).Offset(numAry(i))) = 0 Then
mmm = monthAry(i): Exit For
End If
Next
Erase numAry, monthAry
End Function

use like

=mmm(A1:A12)