I am using the code below to create a date selector. Starting in cell E2 then in each 2 (F2, G2, H2...) thereafter is a date. As more information is added to this sheet I would like to have the date in row 2 be available in the date selector. Below is the code I have so far:
Public Function ColumnLetter(ColumnNumber As Long) As String
ColumnLetter = Split(Cells(1, ColumnNumber).Address(True, False), "$")(0)
End Function
Private Sub UserForm_Initialize()
Dim LastCol As Long
Dim Letter As Variant
cbDatePicker.Clear
With Sheets("Sheet1")
LastCol = Range("E2").End(xlToRight).Column
lastcolletter = ColumnLetter(LastCol)
Letter = lastcolletter & "2"
End With
cbDatePicker.List = Application.Transpose(Sheets("Sheet1").Range("E2:" & Letter).Value)
End Sub
I only get the first four dates and there are currently 12 available in E2:R2.
Thoughts?
Bookmarks