|
| |||||||||
| Tags: excel, range object, value2 property, visual basic applications |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Description of the Value2 property for the Range object in Excel
Hi folks, I am trying to do some coding in Excel using Visual Basic Applications. I have done some basic coding in VBA, so you can consider me as rookie in VBA. I always get confused while studying about the Value2 property. This property is used for the range object in an Excel. So thought that I would get some help from you guys.!! So please provide the description of the Value2 property for the Range object in Excel Any other information related to the topic would be grateful.!!
__________________ He who asks is a fool for five minutes, but he who does not ask remains a fool forever. -Chinese Proverb |
|
#2
| ||||
| ||||
| Re: Description of the Value2 property for the Range object in Excel
I would like to explain you the concepts, so that later on you will find easy to understand this topic. Microsoft Excel includes a property Visual Basic for Applications called Value2. The Value2 property, which you can use for the Range object, is almost identical to the Value property except that the Value2 property does not use the Currency data types and date. Depending on how a cell is formatted, the two properties may return different values for the same cell. Hope that you got the basic point. |
|
#3
| ||||
| ||||
| Re: Description of the Value2 property for the Range object in Excel
You should know that Value2 property is not available in versions prior to Excel 97. Therefore, if a cell is formatted with a number format to currency or number format date, the Value property can not return the expected value of the underlying cell. This applies to the Microsoft Office Excel 2003, and the lower versions of it. Since you have not described the version that you are using, I thought that this information would be useful for you.!!
__________________ Dimension 1100 (FMY032J) mini-tower 2.53ghz Intel Pentium 4 80 gig nfts HDD 512 RAM Main circuit board: Dell 0CF458 BIOS: Dell A00 Display: Intel(R) 82865G Graphics Controller [Display adaptor] Multimedia: Sound MAX Integrated Digital Audio Windows XP Home SP2 |
|
#4
| |||
| |||
| Re: Description of the Value2 property for the Range object in Excel
In the following example, the Value and Value2 properties return different results for the same object cell. To view the results, proceed as follows :
|
|
#5
| ||||
| ||||
| Re: Description of the Value2 property for the Range object in Excel
You can enter the following code in module, in the above step described by 'NIcaBoy'. The code would be : Code: Sub Value_vs_Value2()
'Creates a cell value formatted as Currency
Range("A1").Formula = "$1.23456789"
'Creates a cell value formatted as a Date
Range("A2").Formula = "2/3/1997"
MsgBox "Currency returned by Value property = " & _
Sheet1.Range("A1").Value
MsgBox "Currency returned by Value2 property = " & _
Sheet1.Range("A1").Value2
MsgBox "Date returned by Value property = " & _
Sheet1.Range("A2").Value
MsgBox "Date returned by Value2 property = " & _
Sheet1.Range("A2").Value2
Range("A3").Value = Range("A1").Value
MsgBox "Currency set by Value property = " & _
Range("A3").Value
Range("A4").Value = Range("A1").Value2
MsgBox "Currency set by Value2 property = " & _
Range("A4").Value2
End Sub |
|
#6
| ||||
| ||||
| Re: Description of the Value2 property for the Range object in Excel
The value of underlying cell in cell A1 is 1.23456789. However, the Value property returns 1.2346. This is because Excel stores numbers in currency format integer that is multiplied by 10 000 to produce a fixed-point numbers with fifteen digits to the left of the decimal point and four digits to the right of the decimal. For cells formatted as currency, the Value2 property returns the cell value underlying real. The value of underlying cell in cell A2 is 35,464, which is the serial number, 3 Feb 97. The Value property returns a date in short date format. For cell formatted as a date, the Value2 property returns the serial number of the underlying. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Description of the Value2 property for the Range object in Excel" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date Range via IF THEN statement in Excel | Indudep | MS Office Support | 3 | 1 Week Ago 07:48 PM |
| Javascript Replace function - Object doesn't support this property or method | Trini Alvarado | Software Development | 6 | 13-05-2010 01:11 PM |
| Description of the LINEST function in Excel 2003 | PsYcHo 1 | Windows Software | 5 | 13-03-2010 05:47 AM |
| Excel range finder | ManishS | Windows Software | 2 | 25-06-2009 12:26 PM |
| Run time error:'1004': Method 'Range' of object '_Global' failed | 2muchreality | Software Development | 2 | 11-10-2008 03:46 PM |