Hi experts and gurus,
I am at the end of the automated Report. I am looking to set up an input box that seeks the "Current Report Date" and "Last Report Date", which are then transferred to cells B1 and B2 of a worksheet respectively. The date will be in a specific format "DD/MM/YYYY".
If the date is in invalid format, the message box will be prompted with "invalid date format".
I have tried to write the following code which needs improvement to get the result.
Private Sub A()
Call reportingDate
Worksheets("Test").Range("B1").Value = currep_date
Worksheets("Test").Range("B2").Value = lastrep_date
End Sub
Function reportingDate()
Dim currep_date As Date, lastrep_date As Date
currep_date = InputBox("Enter Current Reporting Date", "Enter a Date")
lastrep_date = InputBox("Enter Last Reporting Date", "Enter Date")
End Function
Can somebody help me to write a code to put a date that is transferred to B1 and B2?
Thank you so much to all the experts and gurus to help me learn VBA.
Roshan Shakya
Bookmarks