Based on this spreadsheet,
Running this line of code will return False
MsgBox IsEmpty(Trim(ThisWorkbook.ActiveSheet.Cells(31, 1)))
But running
=IsBlank(A31)
will return True
Based on this spreadsheet,
Running this line of code will return False
MsgBox IsEmpty(Trim(ThisWorkbook.ActiveSheet.Cells(31, 1)))
But running
=IsBlank(A31)
will return True
It's because you use Trim.
Excel's IsBlank is very restrictive and will only ever give True if the cell is completely empty (not even has a formula that returns empty result). So if that returns True, IsEmpty on the cell's value should also return True.
But what IsEmpty(cell) actually does is detecting whether the cell's .Value contains the special value Variant/Empty. The raw cell value does indeed contain it, and IsEmpty(ThisWorkbook.ActiveSheet.Cells(31, 1)) would return True, but Trim() turns the Variant/Empty into a Variant/String, and a string is never IsEmpty, even when it's zero length.
If for you "empty" means "contains zero length content", then you should check for Len(Trim(ThisWorkbook.ActiveSheet.Cells(31, 1))) = 0.