T
Tony A. Steane
Using xl2000:
If anybdy could assist me I would be thankful.
I'm trying to use the VLOOKUP function within a Public declared
function as such :
Public Function color(address As Range)
ColorRange = Worksheets("sheet1").Range("range")
color = Application.WorksheetFunction.VLookup(address.Value,
ColorRange, 2)
End Function
and the worksheet is set out as such
A B C D
1 04-Mar-04 orange lime
2
3
4 01-Mar-04 grey
5 02-Mar-04 black
6 03-Mar-04 red
7 04-Mar-04 orange
8 05-Mar-04 white
9 06-Mar-04 green
10 07-Mar-04 brown
11 08-Mar-04 purple
12 09-Mar-04 lime
where range is Defined as A4:B12
cell A1 is the date entered for lookup_value
cell C1 uses the =VLOOKUP(A1,Range,2) formula
and in this example returns the correct color for the
date supplied.
Cell D1 formula is =Color(A1) which uses the function included
above, however the function return the value "lime" and not
"orange".
could somebody explain what I'm doing wrong.....
Thanks
Tony
If anybdy could assist me I would be thankful.
I'm trying to use the VLOOKUP function within a Public declared
function as such :
Public Function color(address As Range)
ColorRange = Worksheets("sheet1").Range("range")
color = Application.WorksheetFunction.VLookup(address.Value,
ColorRange, 2)
End Function
and the worksheet is set out as such
A B C D
1 04-Mar-04 orange lime
2
3
4 01-Mar-04 grey
5 02-Mar-04 black
6 03-Mar-04 red
7 04-Mar-04 orange
8 05-Mar-04 white
9 06-Mar-04 green
10 07-Mar-04 brown
11 08-Mar-04 purple
12 09-Mar-04 lime
where range is Defined as A4:B12
cell A1 is the date entered for lookup_value
cell C1 uses the =VLOOKUP(A1,Range,2) formula
and in this example returns the correct color for the
date supplied.
Cell D1 formula is =Color(A1) which uses the function included
above, however the function return the value "lime" and not
"orange".
could somebody explain what I'm doing wrong.....
Thanks
Tony