I using Labview to generate a Excel report that essentially pastes an array into the spreadsheet. There are gaps in the spreadsheet, for example:
1
2
3
1
2
3
But because I am inserting an array into the spreadsheet, the gaps are empty, but they aren't blank.
When I run vba code checking each cell using "IsEmpty," it returns true. But if I run an excel formula using "ISBLANK," it returns false. I have tried the following, but it doesn't make the cell blank.
If IsEmpty(Cells(r,c)) Then
Cells(r,c).Value = ""
Cells(r,c).ClearContents
Cells(r,c) = ""
I want to make the cells blank without having to delete them. This is because I'm trying to use .End
in my VBA code, but it doesn't stop at the gaps.
IsEmpty
would beTrue
, butISBLANK
would be false. – GSergIsEmpty
is a native VBA standard library function that returnsTrue
given aVariant/Empty
, i.e. an uninitializedVariant
variable. The fact that the value of a blank cell (no content, no formula) yields aVariant/Empty
is a convenient coincidence:IsEmpty
was never meant to be used to determine whether an ExcelRange
contains something. – Mathieu Guindon