Auto run macro

B

Bakar

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

Baka
 
D

Don Guillett

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top