1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,837
    Likes Received:
    14,238
    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 Marketplace Mod Moderator

    Joined:
    Nov 29, 2012
    Messages:
    16,534
    Likes Received:
    6,182
    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.