I need some help in this guys, I have an existing column fill with date and I want to add another column beside it with values depending on the date. For example from from 01/01/2015 to 02/15/2015 as January and so on. In this particular format, I tried using codes from my other projects but it does not work. Here are the code:
Code
Sub Month()
Dim Found As Range
Dim LR As Long
Dim WS As Worksheet
Dim cell As Range
Dim a As Variant, v As Variant, num
Set WS = Sheets("PAYABLES - OUTFLOWS")
Set Found = WS.Rows(1).Find(What:="PAYABLES - OUTFLOWS", _
LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then Exit Sub
a = [{"01/18/2015", Jan; "01/19/2015", Jan]
LR = WS.Cells(WS.Rows.Count, Found.Column).End(xlUp).Row
Found.Offset(0, 2).EntireColumn.Insert
WS.Cells(1, Found.Column + 2).Value = "Month"
For Each cell In WS.Range(WS.Range("A1"), WS.Cells(LR, 3))
v = Application.VLookup(cell.Value, a, 2, False)
cell.EntireRow.Cells(Found.Column + 2).Value = IIf(IsError(v), "", v)
Next cell
End Sub
Display More