How can i detect null value in excel? -


i have problem value detection in excel. when doesn't have value in cell want excel show me message warning rather 0 value , have code below.

public function mysum(a range, b range) string      if isnull(a) , isnull(b)         mysum = "no value sir"     else         mysum = a.value + b.value     end if  end function 

here few ways validate parameters

option explicit  public function mysum(a range, b range) string     dim itmsok boolean      mysum = "no value"  'default return value, if or b not valid      itmsok = (not nothing , not b nothing)    'validate range objects      if itmsok itmsok = (not isnull(a.value2) , not isnull(b.value2))       'db vals     if itmsok itmsok = (len(trim(a.value2)) > 0 , len(trim(b.value2)) > 0) 'empty     if itmsok itmsok = (isnumeric(a.value2) , isnumeric(b.value2))         'numbers      if itmsok mysum = val(a.value2) + val(b.value2)   'if both valid, perform math  end function 

(checking nulls more specific importing data database)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -