I am pretty new to VBA but I really don't know why this code isn't working.
I have a column that is always updated with new dates beginning with a new month and year which is then being provided a numeric value in another column on that same row.
For example, for analysis of numbers for June-2016, June will be the first month in the column and be assigned 1. Then for the proceeding 12 months they are incremented by 1 and anything blank or after these 12 months is equal to x. (Feb-2016 = 2, Mar-2016 =3, Apr-2016 = 4....June-2017 =12). And as I mentioned for the next month of July-2016 this will now be assigned a 1 in another column and pattern continues. Will this require a number of different for loops within and if statement?
The code is running with no errors but I don't see any execution of the code. Not sure if I have the if, for and case organized incorrectly?
Any help with this and if possible in making the code more efficient would be greatly appreciated.
Thanks
Dim lngLoop As Long
Dim x As String
Dim L As String
Dim D As Integer
lngLoop = 1
x = Sheets("Portfolio Matrix").Cells(1, 16).Value
L = Sheets("Portfolio Matrix").Cells(lngLoop, 45).Value
D = Sheets("Portfolio Matrix").Cells(lngLoop, 44).Value
If x = July - 2016 Then
For lngLoop = 1 To Rows.Count
Select Case L
Case "Jul-16"
L = 2
Case "Aug-16"
L = 3
Case "Sep-16"
L = 4
Case "Oct-16"
L = 5
Case "Nov-16"
L = 6
Case "Dec-16"
L = 7
Case "Nov-16"
L = 8
Case "Dec-16"
L = 9
Case "Jan-17"
L = 10
Case "Feb-17"
L = 11
Case "Mar-17"
L = 12
Case " "
L = LT
End Select
Cells(lngLoop, 44).Value = result
Next lngLoop
Bookmarks