VBA Check if variable is empty

前端 未结 4 2087
予麋鹿
予麋鹿 2020-12-04 10:13

I have an object and within it I wanna check if some properties is set to false, like:

If (not objresult.EOF) Then
  \         


        
4条回答
  •  感情败类
    2020-12-04 10:34

    For a number, it is tricky because if a numeric cell is empty VBA will assign a default value of 0 to it, so it is hard for your VBA code to tell the difference between an entered zero and a blank numeric cell.

    The following check worked for me to see if there was an actual 0 entered into the cell:

    If CStr(rng.value) = "0" then
        'your code here'
    End If
    

提交回复
热议问题