Excel help?

Discussion in 'BlackHat Lounge' started by meathead1234, Jan 24, 2017.

Thread Status:
Not open for further replies.
  1. meathead1234

    meathead1234 Moderator Staff Member Moderator Premium Member

    Joined:
    Sep 24, 2008
    Messages:
    3,848
    Likes Received:
    14,305
    Hey guys,

    Noob Excel question which I'm sure someone smart here can answer :)

    Trying to run a Macro (which works) if a certain condition is met. In the "view code" -> "worksheet" view I have this:

    Code:
    Private Sub Worksheet_Change()
    If D9.Value = "Yes" Then macroMoveSheet2
        
        End Sub
        
    In this case, I want to run macro MoveSheet2 if cell D9 is says yes.

    What am I doing wrong? :)

    Thanks!
     
  2. Ricky Roma

    Ricky Roma Regular Member

    Joined:
    Sep 23, 2011
    Messages:
    290
    Likes Received:
    392
    Isn't VB used for excel macros? Maybe you'll have more luck posting in programming / VB subforum.
     
  3. lence

    lence Newbie

    Joined:
    May 22, 2017
    Messages:
    2
    Likes Received:
    0
    Gender:
    Female
    Location:
    India
    You try this........

    Private Sub CommandButton1_Click()
    Dim temp As Variant
    temp = Range("D9").Value
    If temp = "yes" Then
    Sheets(2).Select
    End If
    End Sub
     
  4. I know SEO

    I know SEO The Caretaker Moderator Jr. VIP

    Joined:
    Nov 29, 2012
    Messages:
    16,549
    Likes Received:
    6,282
    Gender:
    Male
    Location:
    everywhere
    This is from January, I'm sure he got it sorted.

    Please check the dates before replying to posts in the future.
     
Thread Status:
Not open for further replies.