voyagerphoen
12-10-2018, 12:52 AM
Im using office 2007 in windows 7 pc.this code uses names of months from sheet1. when i run this code it should pop up message in msgbox as i found in tutorial.But instead this do nothing.
Sub currentmontharray()
Dim months(11) As String
Dim i As Integer
Dim xrow As Long
i = 0
xrow = 2
Do Until Cells(xrow, 1).Value = ""
months(i) = Cells(xrow, 1).Value
i = i + 1
xrow = xrow + 1
Loop
For i = 0 To UBound(months, 1)
If months(i) = MonthName(Month(Date)) Then
MsgBox ("current month is " & MonthName(Month(Date)))
End If
Next i
End Sub
Sub currentmontharray()
Dim months(11) As String
Dim i As Integer
Dim xrow As Long
i = 0
xrow = 2
Do Until Cells(xrow, 1).Value = ""
months(i) = Cells(xrow, 1).Value
i = i + 1
xrow = xrow + 1
Loop
For i = 0 To UBound(months, 1)
If months(i) = MonthName(Month(Date)) Then
MsgBox ("current month is " & MonthName(Month(Date)))
End If
Next i
End Sub