ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   indirect formula on VBA (https://www.excelbanter.com/excel-programming/362774-indirect-formula-vba.html)

[email protected]

indirect formula on VBA
 

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


Bob Phillips

indirect formula on VBA
 
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)

wrote in message
ups.com...

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



[email protected]

indirect formula on VBA
 

Thanks a lot, I´m newer in VBA.


Andrew Taylor

indirect formula on VBA
 
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



wrote:
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




All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com