+ Reply to Thread
Results 1 to 2 of 2

Easy Macro

  1. #1
    Registered User
    Join Date
    08-02-2006
    Posts
    19

    Easy Macro

    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 enter "1" into the "A" cell it adds the YES-NO-NO-YES into the other cells shown above. Any help people? Remember i dont want a button just code that works when enter "1" in cell A. Thanks

  2. #2
    NickHK
    Guest

    Re: Easy Macro

    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]...
    >
    > 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 enter
    > "1" into the "A" cell it adds the YES-NO-NO-YES into the other cells
    > shown above. Any help people? Remember i dont want a button just code
    > that works when enter "1" in cell A. Thanks
    >
    >
    > --
    > joelbeveridge
    > ------------------------------------------------------------------------
    > joelbeveridge's Profile:

    http://www.excelforum.com/member.php...o&userid=37045
    > View this thread: http://www.excelforum.com/showthread...hreadid=567724
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1