Hi
Insert a userform with a combobox and a command button.
in the userform module put this code.
Code:
Option Explicit
Private Sub CommandButton1_Click()
ActiveCell.Value = CDate(Me.ComboBox1.Value)
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim Dt() As String
Dim n As Long
Dim cDt As Date
Dim sDt As Date
sDt = Date
Select Case ActiveCell.Column
Case 4
ReDim Dt(1 To 31)
n = 1
Do While sDt >= Date - 30
Dt(n) = Format(sDt, "mm-dd-yyyy")
sDt = sDt - 1
n = n + 1
Loop
With Me.ComboBox1
.List = Dt
.ListIndex = 0
End With
Case 6
ReDim Dt(1 To 15)
n = 1
sDt = Date - 7
Do While sDt <= Date + 7
Dt(n) = Format(sDt, "mm-dd-yyyy")
sDt = sDt + 1
n = n + 1
Loop
With Me.ComboBox1
.List = Dt
.ListIndex = 7
End With
End Select
End Sub
Right click TASKS worksheet > view code and paste the following code
Code:
Option Explicit
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Select Case Target.Column
Case 4, 6
Cancel = True: UserForm1.Show
End Select
End Sub
Now right click on Col 4 or 6, the userform will popup with a set of dates and select one date hit the command button.
I can't upload a file that's why this detailed explanatin.
Bookmarks