S
Scott
I have a sub below called CreateMonthValues() that I'm simply trying to
insert the 12 month names into range (B1:B12). I'm trying to use an array to
hold the month names, but I get an error saying "can't assign value to
array", on the line below that begins "arryMonthList = Array("January",
"Febuary", etc.).
I'm not real good with arrays and was hoping someone could help me modify my
sub to populate the range (B1:B12) with the 12 month names.
Any help?
CODE ******************************************
Sub CreateMonthValues()
Dim arryMonthList(1 To 12) As String
arryMonthList = Array("January", "Febuary", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December")
Dim c As Range
Sheets("DateHelper").Select
Range("B1").Select
'set a range variable equal to the first data cell in column B
Set c = ActiveSheet.Range("B1")
Dim iCount As Integer
Dim Max As Integer
Max = 12 ' maximum array size
ReDim MyNames(1 To Max) ' declares the array variable with the necessary
size
For iCount = 1 To Max
c.Offset(0, 0).Value = arryMonthList(iCount)
'set c to the next cell down
Set c = c.Offset(1, 0)
Next iCount
End Sub
insert the 12 month names into range (B1:B12). I'm trying to use an array to
hold the month names, but I get an error saying "can't assign value to
array", on the line below that begins "arryMonthList = Array("January",
"Febuary", etc.).
I'm not real good with arrays and was hoping someone could help me modify my
sub to populate the range (B1:B12) with the 12 month names.
Any help?
CODE ******************************************
Sub CreateMonthValues()
Dim arryMonthList(1 To 12) As String
arryMonthList = Array("January", "Febuary", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December")
Dim c As Range
Sheets("DateHelper").Select
Range("B1").Select
'set a range variable equal to the first data cell in column B
Set c = ActiveSheet.Range("B1")
Dim iCount As Integer
Dim Max As Integer
Max = 12 ' maximum array size
ReDim MyNames(1 To Max) ' declares the array variable with the necessary
size
For iCount = 1 To Max
c.Offset(0, 0).Value = arryMonthList(iCount)
'set c to the next cell down
Set c = c.Offset(1, 0)
Next iCount
End Sub