indirect formula on VBA

  • Thread starter Thread starter cesgonzalez
  • Start date Start date
C

cesgonzalez

I need to use indirect formula on VBA

with application.indirect doesn´t work, that property doen´st appears

myfunction
dim myRange as Range
myRange = Cells(2, 3).Address
value = myRange.Value -->> doesn´t works!!!

any solution??? I´m desperate.

Thanks
 
dim myRange as Range
Set myRange = Cells(2, 3)
value = myRange.Value

Not a good idea to use value as a variable name.

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)


I need to use indirect formula on VBA

with application.indirect doesn´t work, that property doen´st appears

myfunction
dim myRange as Range
myRange = Cells(2, 3).Address
value = myRange.Value -->> doesn´t works!!!

any solution??? I´m desperate.

Thanks
 
dim myRange as Range
myRange = Cells(2, 3).Address

Since myRange is a Range, which is an Object type,
this should be:

Set myRange = Cells(2,3)
value = myRange.Value -->> doesn´t works!!!

as Bob has pointed out, you can't use the reserved word
"value" as a variable, Try:

Dim myValue as Variant
myValue = myRange.Value

However, you could cut out myRange and shorten the
code to:

Dim myValue as Variant
myValue = Cells(2,3).Value

I'm not sure where the Indirect function comes in -
perhaps you could explain exactly what you're
trying to do.


Andrew Taylor
 
Back
Top