Hi everyone,
I don't understand this logic. When I dimension a date such as the following satement:
(1)
Dim StartDate As Date
Set StartDate = Thisworkbook.Worksheets("Report").Range("A1").Value
I got a error message that says "Compile error, Object required" What does this mean? However, when a date dimensioned as Variant and without SET statement then it runs OK. Also, if I set StartDate = Thisworkbook.Worksheets("Report").Range.Value without the Dim Statement. This works as well.
(2) and (3) work , Why does (1) not work?
Thanks for your help in advance.
(2)
Dim StartDate As Variant
(3)
StartDate = Thisworkbook.Worksheets("Report").Range("A1").Value
I don't understand this logic. When I dimension a date such as the following satement:
(1)
Dim StartDate As Date
Set StartDate = Thisworkbook.Worksheets("Report").Range("A1").Value
I got a error message that says "Compile error, Object required" What does this mean? However, when a date dimensioned as Variant and without SET statement then it runs OK. Also, if I set StartDate = Thisworkbook.Worksheets("Report").Range.Value without the Dim Statement. This works as well.
(2) and (3) work , Why does (1) not work?
Thanks for your help in advance.
(2)
Dim StartDate As Variant
(3)
StartDate = Thisworkbook.Worksheets("Report").Range("A1").Value