Why is .Value not necessary in my code?

Dimitris254

Board Regular
Joined
Apr 25, 2016
Messages
139
Rich (BB code):
vararray_test(i, 1) = vararray_test(i, 1) * Worksheets("exchange_rate").Cells(1, "B").Value

i got one variant array in a local currency, then convert it to EUR (i do this for more values, hence the loop). The variant is filled with a range from a sheet "data". The cell (1, "B") holds the exchange rate for that currency.

The result is correct with and without the Value. Why? :confused:

Also, is it possible to convert the whole array to USD, by simply:
Rich (BB code):
' today's EUR to USD exchange rate = 1.15
vararray_test= vararray_test * 1.15
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
It is not necessary because Value is the default property for the Range object. Personally, I always use it regardless, I don't trust MS to always keep it that way, at least I didn't when VBA was still a viable product in their marketing eyes.
 
Upvote 0
...and no, AFAIK, there is no way to work on all the elements of the array at once.
 
Upvote 0
It is not necessary because Value is the default property for the Range object. Personally, I always use it regardless, I don't trust MS to always keep it that way, at least I didn't when VBA was still a viable product in their marketing eyes.
was there a time that .Value was not the default property?

i'm new to VBA but i'm always interested in good programming techniques, one of which is to define something that was changed or might change in the future :)


@GTO: so, another loop is the only way?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,443
Messages
6,159,907
Members
451,601
Latest member
terrynelson55

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top