Hi All,
I am constructing some code that initially begins by asking for a date using an inputbox.
Then later in the macro I am trying to use the date submitted to calculate number of days in a formula. The lines that matter are as follows:
Dim MonthEndDate As Date
MonthEndDate = InputBox("What is the date of the month end? dd/mm/yyyy")
I am constructing some code that initially begins by asking for a date using an inputbox.
Then later in the macro I am trying to use the date submitted to calculate number of days in a formula. The lines that matter are as follows:
Dim MonthEndDate As Date
MonthEndDate = InputBox("What is the date of the month end? dd/mm/yyyy")
Code:
Range("E2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]<=MonthEndDate,"""",""Y"")"
where the RC[-1] is a date in E2 and the MonthEndDate is the date input into the InputBox.
The formula does not work and comes up as #NAME?
Any solutions? Forever greatful
Ian