sijpie
Well-known Member
- Joined
- Nov 1, 2008
- Messages
- 4,241
- Office Version
- 365
- Platform
- Windows
- MacOS
I am running into an intricate problem to do with that apparently an empty Variant is not the same as one filled with vbNullstring and neither are the same (logically) as one set to Nothing
I have a variant which i set to a range in the worksheet.
When looking at the variant in the Watch window, then the empty cells in the sheet show up as 'Empty' in the Watch window
I have a test somewhere in my code which checks if a value in a column (of the array vProj) is larger than some variable:
This works fine until I insert a row in my array.
I do this with a modification of one of Chip Pearson's array functions, by adding a row at the bottom of the array and then moving all the rows from the insertion point down. The inserted row values I then set to vbNullstring.
Now the above code doesn't work anymore because (for some reason) if vProj(lSnxt, 4) contains vbNullstring the comparison is TRUE.
I could do something like
This works with vbNullstring but not with 'Empty' !
Anybody have a solution to this? I guess I could use a double if:
but it becomes kind of dirty.
I have a variant which i set to a range in the worksheet.
When looking at the variant in the Watch window, then the empty cells in the sheet show up as 'Empty' in the Watch window
I have a test somewhere in my code which checks if a value in a column (of the array vProj) is larger than some variable:
Code:
If vProj(lSnxt, 4) > iRL Then Exit For
This works fine until I insert a row in my array.
I do this with a modification of one of Chip Pearson's array functions, by adding a row at the bottom of the array and then moving all the rows from the insertion point down. The inserted row values I then set to vbNullstring.
Now the above code doesn't work anymore because (for some reason) if vProj(lSnxt, 4) contains vbNullstring the comparison is TRUE.
I could do something like
Code:
If CInt(vProj(lSnxt, 4)) > iRL Then Exit For
Anybody have a solution to this? I guess I could use a double if:
Code:
if isnumeric(Myvariant) then
if Myvariant > i then