VBA script prompting user to type in a date

vs127739

New Member
Joined
May 3, 2018
Messages
4
I have F2 returning True and False depending whatever conditions are met, and I want a pop up to appear asking user to enter date that will appear in G2.

I want to make a VBA script that does the following:

If F2 is TRUE, then a Pop Up appears prompting user to input a date in format MM/DD/YYYY in G2. The date entered must be any date after TODAY. I would prefer the user to be able to change the date at a later time. If the user enters a date of TODAY or before TODAY, the Pop Up should redirect to enter any date after today as an error message.
If F2 is FALSE, then G2 should be left blank. However, the option to enter a date in format MM/DD/YYYY should be left open if user wants to change date.

I basically want to do this again for F3 and G3, all the way up to F37 and G37. If can make this in one script instead of many, that would be awesome.

I have no skills in making VBA scripts. Can anyone help?
No idea on what I'm doing.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
right click on the tab you want this to happen, VIEW code and paste this in:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$F$2" Then
If Range("F2") = True Then
dbox = InputBox("Input date MM/DD/YYYY (AFTER " & Format(Now(), "MM/DD/YYYY") & ")")
While dbox <= Format(Now(), "MM/DD/YYYY") And dbox <> ""
dbox = InputBox("Input date MM/DD/YYYY (AFTER " & Format(Now(), "MM/DD/YYYY") & ")")
Wend
Range("G2") = Format(dbox, "MM/DD/YYYY")
End If
End If
End Sub

When F2 changes to true, a popup will occur.
 
Upvote 0
It does work on another worksheet. I guess I don't know how to add a new script after I have another one. Do you have to do something special if another code is running in the background?
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top