Boolean value indicating whether the variable has been initialized. "Syntax" IsEmpty (expression) The necessary expression argument is a Variant that contains a numeric or string expression (which can actually also be a cell). However, because IsEmpty is used to determine whether individual variables have been initialized,
True False. If expression contains more than one variable , False.
IsEmpty only returns information that is meaningful to the variant expression.
'determine if a worksheet is using a custom functionFunctionIsusedsheet (ByValSheet asWorksheet) as BooleanIsusedsheet=IsEmpty (sheet. UsedRange)End Function'Determine whether a worksheet is an empty worksheet (that is, the value of the cell is empty) custom functionFunctionIsemptysheet (ByValSheet asWorksheet) as Boolean IfApplication.WorksheetFunction.CountA (sheet. Cells) >0 ThenIsemptysheet=False ElseIsemptysheet=True End IfEnd FunctionSubShttest ()'Test DimSht1 asWorksheet for eachSht1inchSheets Debug.Print sht1. Name&"Is empty?"&Isemptysheet (sht1) Debug.Print sht1. Name&"Is used?"&Isusedsheet (sht1)Next End Sub
Excel VBA Determines whether a worksheet is empty or used (such as setting a border)