Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Difference between .value and .value2

So, looking at the HelpFile it says that the difference between .Value and
..Value2 is that the latter does not accept Currency or Date data types.

With that in mind, why would you ever wish to use .Value2? To me it seems
that it's limiting and offers no real value.

Can anyone tell me why it'd be better to use .Value2 over .Value.

TIA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Difference between .value and .value2

Dave,
As I understand it:
With ActiveCell
.Value = "1/1/2005"
MsgBox .Value2
End With

you can see that the .Value would depend on the format of the locale, but
..Value2 gives you DateSerial so you know exactly which day is meant.
Same thing with currency and decimal/digit grouping symbols.

NickHK

"DaveO" wrote in message
...
So, looking at the HelpFile it says that the difference between .Value and
.Value2 is that the latter does not accept Currency or Date data types.

With that in mind, why would you ever wish to use .Value2? To me it seems
that it's limiting and offers no real value.

Can anyone tell me why it'd be better to use .Value2 over .Value.

TIA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Difference between .value and .value2

It is a matter of overhead in dealing with those two data types which have
variables according to locale, language, monetary systems and calendar
systems, etc. Telling Excel it does not have to deal with these two monster
types, it can work quicker with less resources. But it also means much
greater diligence on your part to separate the values from the value2s. That
is why most don't use value2. As an example I had written code for a report
that took right at 6 minutes to run, using all .Value. It took me over 4
hours to replace with .Value2 and still run properly. At this point the
speed of the report was 8 seconds faster.
There's my $.02 worth
Mike F
"DaveO" wrote in message
...
So, looking at the HelpFile it says that the difference between .Value and
.Value2 is that the latter does not accept Currency or Date data types.

With that in mind, why would you ever wish to use .Value2? To me it seems
that it's limiting and offers no real value.

Can anyone tell me why it'd be better to use .Value2 over .Value.

TIA.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Difference between .value and .value2


For writing international dates and currencies it's much easier
to use .value2 as it avoids automatic formatting.

Sub foo()
Dim MyDate As Currency
Dim MyCurr As Variant
MyCurr = 123.45
MyDate = Now
[a1].Value = MyDate
[b1].Value2 = MyDate
[a2].Value = MyCurr
[b2].Value2 = MyCurr

End Sub


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


NickHK wrote in

Dave,
As I understand it:
With ActiveCell
.Value = "1/1/2005"
MsgBox .Value2
End With

you can see that the .Value would depend on the format of the locale,
but .Value2 gives you DateSerial so you know exactly which day is
meant. Same thing with currency and decimal/digit grouping symbols.

NickHK

"DaveO" wrote in message
...
So, looking at the HelpFile it says that the difference between
.Value and .Value2 is that the latter does not accept Currency or
Date data types.

With that in mind, why would you ever wish to use .Value2? To me it
seems that it's limiting and offers no real value.

Can anyone tell me why it'd be better to use .Value2 over .Value.

TIA.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Difference between .value and .value2

typos!

Sub foo()
dim MyDate as date
dim MyCurr as currency
MyCurr = 123.45
MyDate = Now
[a1].Value = MyDate
[b1].Value2 = MyDate
[a2].Value = MyCurr
[b2].Value2 = MyCurr
end sub

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Difference between .value and .value2

Mike,

I disagree... maybe most americans dont use :)
In international environment it can save a LOT of hassle
just using value2 and take care of formatting separately.

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Mike Fogleman wrote in
<news:<otKdnefba8_pjUbZnZ2dnUVZ_uudnZ2d@insightbb. com

SNIP That is why most don't use value2.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel & C# NullReference Error when trying to set Range.Value2 Chuck Excel Programming 1 August 2nd 06 11:01 PM
Merged cells Value2 property Sandrina Excel Programming 1 February 6th 06 02:58 PM
Lookup Value2 Len Excel Programming 11 April 17th 05 11:50 AM
scatter plots and "label" as ("X" value1, value2) shabnam Charts and Charting in Excel 3 April 11th 05 02:24 PM
Activecell.value or value2? Sirin Excel Programming 2 November 22nd 04 12:01 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"