Find method syntax
That is because in the first example you have the Find arguments out of
order, LookIn comes before LookAt in the order. By specifying the keywords
that doesn't matter, but when you don't specify them you need to be in the
correct order.
So
lastcolumn = Cells.Find("*", Range("A1"), xlValues, xlPart,
xlByColumns, xlPrevious, False).Column
should work
--
HTH
Bob Phillips
"Stefi" wrote in message
...
Hi All,
I'd like to understand the difference between these two syntaxes below:
a./ lastcolumn = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlValues, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
This one works!
b./ lastcolumn = Cells.Find("*", Range("A1"), xlPart,
xlValues, xlByColumns, xlPrevious, False).Column
This one does not work at the same place in the code, but gives an error
message No. 1004 saying Find property of Class range not accessible!
Regards,
Stefi
|