ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I clear the contents of one cell from another cell? (https://www.excelbanter.com/excel-worksheet-functions/47273-how-do-i-clear-contents-one-cell-another-cell.html)

RonB

How do I clear the contents of one cell from another cell?
 
I would like to clear the contents of a cell in an Excel worksheet from
another cell in the same worksheet based on the content of that other cell.
Stating it in words: if cell A2 equals 1 then set cell A1 equal to "blank".
Is there a simple way to do this? I am using cell A1 for input by the user
therefore A1 cannot contain an equation.

David Hepner

You could use this VBA code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A2").Value = 1 Then Range("A1").Value = ""
End Sub


"RonB" wrote:

I would like to clear the contents of a cell in an Excel worksheet from
another cell in the same worksheet based on the content of that other cell.
Stating it in words: if cell A2 equals 1 then set cell A1 equal to "blank".
Is there a simple way to do this? I am using cell A1 for input by the user
therefore A1 cannot contain an equation.



All times are GMT +1. The time now is 02:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com