We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Range.Text value reads Nothing?

I am trying to read the value of "B2" in the worksheet named "Capture". The Value is coming from no where like the other cells which has list validations. It has just been typed.

When i do
Dim FileDate As String
FileDate = sheet1.Range("B2").Text
FileDate reads the value as Nothing.
Format cell type of B2 is Custom dd-mmm-yy

Sameway B3 is also Custom dd-mmm-yy
if i do
Dim AType As String
AType = sheet1.Range("B3").Text
AType reads RDTE (AEGIS)

Both are of same cell format type,Protected ot not why they behave differently?

I am attaching the file in Question



Revised 14AUG08 - Copy_ce723248.zip

1 Reply

YG Yavanaarasi G Syncfusion Team August 19, 2008 06:29 AM UTC

Hi Vidhya,

I am able to see the issue that you mentioned here. The cell "B2" has the date value. Hence while using Range.text it returns null. But this can be solved by the below two ways:

-You can get the cell value by using the "Value" property.
[or]
-You can get the text of the cell by using the "DisplayText" property.

Below is the code snippet:

[VB]
//value
MessageBox.Show("value of B2:" & sheet.Range("B2").Value)

//DisplayText
MessageBox.Show("Text of B2:" & sheet.Range("B2").DisplayText)


Here is the sample for your reference:

http://www.syncfusion.com/development/uploads/XlsIO_Win_CellRange_e34697a7.zip


Please try this and let me know if this helps.

Regards,
G.Yavana


Loader.
Live Chat Icon For mobile
Up arrow icon