Clear Contents Function

mem_dawg

New Member
Joined
Oct 30, 2011
Messages
38
Hi All,

Is it possible to create a function that clears the contents of a cell when the criteria is met?

For instance, if A1>0 then Clear Contents of A1.

Cheers,
mem
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
No. A function can only return a value. It can't perform actions like clearing a cell.
 

mem_dawg

New Member
Joined
Oct 30, 2011
Messages
38
thanks Andrew, i found this alternative solution

Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(1, 1).Value > 0 Then Cells(1, 1).ClearContents
End Sub
i can copy that if line for the cells I want to clear, so it does what I need.

cheers,
mem
 

Forum statistics

Threads
1,085,723
Messages
5,385,468
Members
401,956
Latest member
MadameHugo

Some videos you may like

This Week's Hot Topics

Top