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

handling empty cells when the variable is oher type than string

Hi,

Is there a better way to program a case when,reading data from an excel-sheet, a cell is empty and the data from the cell should go to a double variable?

This works:
Dim d as double
If sheet.Range(Row, 1).Value <> "" Then
d = sheet.Range(Row, 1).Value
End If

However it would be nicer not to have the if clause.

TIA,
Kari

1 Reply

MW Melba Winshia Syncfusion Team October 23, 2006 07:13 AM UTC

Hi Kari,

Use the following code snippets to check if the cell is blank or not.

[VB]
sheet.Range(2, 1).IsBlank = False

Here is the sample for your reference:

Blank.zip


Please take a look at the sample above and let me know if you have any other questions.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon