View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default List cell values seperated by comma if criteria met

How about:

Sub mike()
Dim d As Date
Dim s As String
s = ""
m = Month(Now())
n = Cells(Rows.Count, "B").End(xlUp).Row
first = True
For i = 2 To n
m1 = Month(Cells(i, "B").Value)
If m1 = m Then
If first Then
first = False
s = Cells(i, "A").Value
Else
s = s & "," & Cells(i, "A").Value
End If
End If
Next
Sheets("Sheet2").Range("A1").Value = s
End Sub

--
Gary''s Student - gsnu200726