Null statement

  • Thread starter Thread starter Sok Hong
  • Start date Start date
S

Sok Hong

How do you set the commands that if the activecell is null
or blank, it carries out certain commands? This is the
syntax I have right now, but the null command doesn't seem
to be working correctlly. Please help, thank you.

If ActiveCell Is Null Then

Selection.AutoFill Destination:=Range(Cells("33",
ActiveCell.Column - 1), Cells("33", ActiveCell.Column)),
Type:=xlFillDefault
Range("B30").End(xlToRight).Select
ActiveCell.Offset(rowOffset:=6, columnOffset:=-1).Select
Range(Cells("36", ActiveCell.Column - 1), Cells("40",
ActiveCell.Column - 1)).Select
Selection.AutoFill Destination:=(Range(Cells("36",
ActiveCell.Column - 1), Cells("40",
ActiveCell.Column)).Select), Type:=xlFillDefault

End If
 
You could try the Is Nothing Statement

or try Search = cell.Find(What="")

If Search Is Nothing then
else
end if...
 
Is Null refers to object variables. ActiveCell Is Null would be true only if there were no
active cell (is that possible?). You want to know something about the CONTENTS of the active
cell -- is it empty. You can learn that with If ActiveCell.Value = "" Then

Note that I use the Value property of the cell, which happens to be the default property.
 
Back
Top