Results 1 to 4 of 4

Call method based on cell change/value

Threaded View

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    U.S
    MS-Off Ver
    Excel 2007
    Posts
    34

    Call method based on cell change/value

    Hello,

    I am attempting to have my macro run anytime the value of B1 changes. If B1 = 1, I want to run (just for example) Sub x, if B1 = 2, run Sub y, if B1 = 3, run Sub z. Here's my code so far, which does not include the B1 value at all, just if B1 changes, run macro. I'm a noob at this, but I think I'm looking for an "And" clause to add on to each of my If statements.
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Cells.Count > 1 Then Exit Sub
    If Target.Address = "$B$1" Then Run "Sheet1.x"
    If Target.Address = "$B$1" Then Run "Sheet1.y"
    If Target.Address = "$B$1" Then Run "Sheet1.z"
    Any help would be appreciated
    Last edited by Leith Ross; 07-17-2012 at 12:19 PM. Reason: Added Code Tags

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