Range with "Large"
Cells is returning values. Large wants a range (more precisely, an array).
I am slightly confused about your ambition. However, the following MAY help:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
myrange = Target.Address & ":" & Target.Offset(10).Address
cdamount = WorksheetFunction.Large(Range(myrange), 1)
MsgBox cdamount
End Sub
I interpretted from your question's code that you wanted Large to apply to
column B.
If you want large applied to a row, instead of a column, just change
Target.Offset(10).Address
to
Target.Offset(,10).Address
If I totally misunderstand what you are trying to do, please add further
information
HTH
--
Steve
"art" wrote in message
...
Hello all:
Can someone please help me with this. I have the following vba code:
cdamount = WorksheetFunction.Large(Cells(target1,"B"):(Rows(t arget2,"B")),
amount1)
target1 = Target.Row
target2 = Target.Row + 10
The range for "large" does not work correctly, what should I change to get
this right?
I want to use a worksheet code "Worksheet_SelectionChange" that when I
change my selection it should show me ina differnt cell the "large" of
that
specific row which is active.
Please help.
Thanks.
|