简体   繁体   中英

Check if cell if empty

I am trying to check if the cell (A5) in sheet tstDash is empty. Currently the cell contains a formula but sometimes it the result is blank and sometimes is a number.

If it is blank, I want a message box. Otherwise perform other function.

I have this code but it is completely ignoring the line and giving me fits.

If chk25thPercentile.Checked = True And Globals.tsdDash.Range("A5").Value Is DBNull.Value

尝试这个 ..

If chk25thPercentile.Checked And IsDBNull(Globals.tsdDash.Range("A5").Value)

What language are you writing in ? VBA or VB.Net ? VBA won't accept IsDBNull. If you are in VBA you want to be testing for the blank result of the formula, which is probably just an empty string "" I expect you need something like

If chk25thPercentile.Checked And Globals.tsdDash.Range("A5").Value = ""

That is assuming that the result of your formula is an empty string, if the cell is actually blank, ie, without a formula you might want to look at ISBLANK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM