Hi all,
I have 2 questions...
1. Don´t quite understand why I get an error when using this VBA code. It does not like me using curdate in the Hlookup statement
when I change the code to this (replace curdate)
it works just fine ...
in B34 is a date eg. 01.01.2018 and in the Range AK2:AW2 are various dates in the same format.
I changed the
2. in the working code, it returns 43101 ?? where does that value come from ? I tried with 01.01.2018 in cell B34 and it is also in the search range. I would like it to simply return a 1 if found and a 0 if not found.
Thank you as always.
I have 2 questions...
1. Don´t quite understand why I get an error when using this VBA code. It does not like me using curdate in the Hlookup statement
Code:
Sub ph()
'Dimensioning
Dim curdate As String
Dim ph As Variant
'Set values
curdate = Range("B34")
'work things out
MsgBox WorksheetFunction.HLookup(curdate, ActiveSheet.Range("AK2:AW2"), 1, False)
End Sub
when I change the code to this (replace curdate)
Code:
Sub ph()
'Dimensioning
Dim curdate As String
Dim ph As Variant
'work things out
MsgBox WorksheetFunction.HLookup(Range("B34"), ActiveSheet.Range("AK2:AW2"), 1, False)
End Sub
it works just fine ...
in B34 is a date eg. 01.01.2018 and in the Range AK2:AW2 are various dates in the same format.
I changed the
2. in the working code, it returns 43101 ?? where does that value come from ? I tried with 01.01.2018 in cell B34 and it is also in the search range. I would like it to simply return a 1 if found and a 0 if not found.
Thank you as always.