Results 1 to 6 of 6

Calling a Variable Subroutine

Threaded View

  1. #1
    Registered User
    Join Date
    09-27-2007
    Posts
    3

    Calling a Variable Subroutine

    Greetings fellow VBA'ers. I am relatively new to VBA programming but am working on some VBA code for work. I am using Excel 2003, and have really been struggling with structuring nested if/then/else logic properly. I often get "End If without Block If" errors such as in the case below. Can somebody help me with the proper structure? Thanks in advance.

    ----------------------------------------
    Yes, I know that the code is probably very inefficient. Right now, I'm just trying to get something that works.

    Sub Adjust()
    Dim Pattern As Integer
    Pattern = Sheets("Info").Range("R7").Value
    If Pattern = 1 Then Call OneCrew Else End If
    If Pattern = 2 Then Call TwoCrew Else End If
    If Pattern = 3 Then Call ThreeCrew Else End If
    If Pattern = 4 Then Call OneCrew Else End If
    If Pattern = 5 Then Call TwoCrew Else End If
    If Pattern = 6 Then Call ThreeCrew Else End If
    End Sub
    Last edited by WayneFontes; 09-27-2007 at 03:25 PM.

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