I have a macro that runs scenarios based on different time frames entered by users. It works properly if a user enters 2 or more scenarios as dates - it fails if someone enters only one date. This block works properly for 2 or more:
countofscenarios = Range(Range("B5"), Range("B5").End(xlDown)).Count
I just can't figure out how to make it work with only 1 date entered - I've tried different variations along the lines of:
If Range("B5") <> "" And Range("B6").End(xlDown).Count = 0 Then
countofscenarios = 1
Else
countofscenarios = Range(Range("B5"), Range("B5").End(xlDown)).Count
End If
But I receive an Overflow error. Apologies for lack of working data but I can strip something down if that will help. Thanks in advance.
Range("B6").End(xlDown)does, you can go to excel, select a cell, and press: ctrl + shift + down. If you do this in B5 and there is data in B6 it will select B5 + B6, if you do this in B5 and there is no data in B6 it will select till the end of the worksheet.