ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto run macro (https://www.excelbanter.com/excel-programming/447512-auto-run-macro.html)

Bakar

Auto run macro
 
Hi Masters
I Have a macros telling if cell B2 is not blank
clear contents in cell B3
Sub remvpw()
If Range("b2") = "1234" Then
Range("b3").Select
Selection.ClearContents
End If
End Sub
But i can run the macro only by view macros
I want to auto run whenever i insert anything in the cell B2


Plz help
Thnxs

Bakar

Don Guillett[_2_]

Auto run macro
 
On Monday, October 29, 2012 5:21:47 AM UTC-5, Bakar wrote:
Hi Masters

I Have a macros telling if cell B2 is not blank

clear contents in cell B3

Sub remvpw()

If Range("b2") = "1234" Then

Range("b3").Select

Selection.ClearContents

End If

End Sub

But i can run the macro only by view macros

I want to auto run whenever i insert anything in the cell B2





Plz help

Thnxs



Bakar









--

Bakar


put this macro into the worksheet module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("b2").Address Then Range("b3").Clear
End Sub


All times are GMT +1. The time now is 04:48 PM.

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