excel - Not Null in VBA -


if sheets("dealcomparison").cells(z + 1, 1) <> "" 

is statement right? want check if particular sheet not equal null in vba

dim x integer      x = 2  dim z long dim myarray(1 9) string      z = 1 9         if trim(sheets("dealcomparison").cells(z + 1, 1)) <> ""             myarray(z) = sheets("dealcomparison").cells(z + 1, 1)              debug.print myarray(z)         end if     next z 

this full code guys,

now want is,i want check if empty , if not empty hav pass .

so whaat should mention in else statement fine ..

if wish determine if object null should use isnull function:

debug.print isnull(sheets("dealcomparison").cells(z + 1, 1)) 

or

debug.print isnull(sheets("dealcomparison")) 

to test if particular sheet null, question asks.

if want test 0 length string more efficient test using len(string) = 0 string = "" strings stored in memory number of characters first, followed number of characters , null terminated character. makes string length more readily available testing characters , avoids memory allocation operations involved.

    if len(trim(sheets("dealcomparison").cells(z + 1, 1))) = 0         myarray(z) = sheets("dealcomparison").cells(z + 1, 1)          debug.print myarray(z)     end if 

there's interesting review of how strings stored in vb6/vba here.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -