Results 1 to 8 of 8

IF statement in sub procedure (syntax ?)

Threaded View

  1. #7
    Registered User
    Join Date
    06-15-2012
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: IF statement in sub procedure (syntax ?)

    Hi tkowal,

    Very sorry for the delayed response. I know what it's like to get busy at work

    That's so much for doing that. For some reason I was still having difficult and it was probably cascading from my poor programming elsewhere when I tried to copy paste that into the complete spreadsheet. I know what I want to do, and end up figuring it out, albeit sloppy but it as long as it gets the task at hand done, I suppose ok. Doesn't help folks like you. Definately saving your code for the future. Anyway, I hunted a VB person at work, he came up with this for me and it did the trick:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim First As String
    Dim Second As String
    First = Range("K32").Value
    Second = Range("K34").Value
    If First = "" Or Second = "" Then
    ActiveSheet.Shapes("SFInstructionsTxt").Visible = True
    ActiveSheet.Shapes("EligInstructionsTxt").Visible = True
    ActiveSheet.Shapes("TextBox5").Visible = False
    ActiveSheet.Shapes("TextBox6").Visible = False
    ElseIf First = "PROCEED" And Second= "PROCEED" Then
    ActiveSheet.Shapes("SFInstructionsTxt").Visible = False
    ActiveSheet.Shapes("EligInstructionsTxt").Visible = True
    ActiveSheet.Shapes("TextBox5").Visible = True
    ActiveSheet.Shapes("TextBox6").Visible = False

    ElseIf First = "INELIGIBLE" Or Second = "INELIGIBLE" Then
    ActiveSheet.Shapes("SFInstructionsTxt").Visible = True
    ActiveSheet.Shapes("EligInstructionsTxt").Visible = False
    ActiveSheet.Shapes("TextBox5").Visible = False
    ActiveSheet.Shapes("TextBox6").Visible = True
    Else
    ActiveSheet.Shapes("SFInstructionsTxt").Visible = True
    ActiveSheet.Shapes("EligInstructionsTxt").Visible = True
    ActiveSheet.Shapes("TextBox5").Visible = False
    ActiveSheet.Shapes("TextBox6").Visible = False
    End If
    End Sub

    Thanks again!
    Last edited by MaddyG; 06-21-2012 at 09:11 PM. Reason: small change in copy/past error

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