Easy Macro

J

joelbeveridge

Hey i have Created this Easy Macro-

Sub testmacro()
'
' testmacro Macro
' A Cell adds info to other cells
'
Range("A1").Select
ActiveCell.FormulaR1C1 = "1"
Range("B1").Select
ActiveCell.FormulaR1C1 = "YES"
Range("C1").Select
ActiveCell.FormulaR1C1 = "NO"
Range("D1").Select
ActiveCell.FormulaR1C1 = "NO"
Range("E1").Select
ActiveCell.FormulaR1C1 = "YES"
Range("A1").Select
End Sub


Now this Macro is a Button which i dont want. I want it so when i ente
"1" into the "A" cell it adds the YES-NO-NO-YES into the other cell
shown above. Any help people? Remember i dont want a button just cod
that works when enter "1" in cell A. Thank
 
N

NickHK

Joel,
Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1")) Is Nothing Then
If Target.Value = 1 Then
Range("B1").Value = "YES"
Range("C1").Value = "NO"
Range("D1").Value = "NO"
Range("E1").Value = "YES"
Else
Range("B1:E1").ClearContents
End If
End If
End Sub

Change what you want to happen is the value <> 1.

NickHK

"joelbeveridge" <[email protected]>
wrote in message
news:[email protected]...
 

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