Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Atlanta, GA
    Posts
    220
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compile Error Else without If (Office 97)

    Can someone tell me why I'm getting this error?

    Thanks.

    Sub resetall()
    '
    ' resetall Macro
    ' Macro recorded 12/16/02 by wfjdi0r'

    If Range("$e$28").Value = 3 Then resetassumptions3
    ElseIf Range("$e$28").Value <> 3 Then resetassumptions2

    End If

    "resetassumptions 2 and 3 are macros"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Compile Error Else without If (Office 97)

    You must either use the single-line form

    If condition Then instructions Else otherinstructions

    or the multi-line form

    If condition1Then
    instructions
    ElseIf condition2 Then
    otherinstructions
    End If

    You can't mix the two. In this case, I think that you don't need the second condition: either

    If Range("$e$28").Value = 3 Then resetassumptions3 Else resetassumptions2

    or

    If Range("$e$28").Value = 3 Then
    resetassumptions3
    Else
    resetassumptions2
    End If

    should work.

  3. #3
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Atlanta, GA
    Posts
    220
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile Error Else without If (Office 97)

    It worked.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •