"End if without block If" - What does that mean?

easybpw

Active Member
Joined
Sep 30, 2003
Messages
439
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Can anyone tell me what that means and how I can go about fixing it. It is an error I encountered when running a macro. I'm very confused.

Thanks,

Bill
 
Thank you for your reply.

I somehow solved the error now it works fine. I just moved the "xprint=True" on next line. It was on the same line of "IF" command at the start.

Thanks anyway.



You are getting yourself tied up in knots with your "If" statements and your "For" loops

If using nested "For-Next loops" it always helps when using "Next" to include what next it is. eg:
Code:
For j = 1 to 100

Next [COLOR=#ff0000][B]j[/B][/COLOR]

I tried fixing your code but got tied up myself. Having structured code helps dodge these common headaches. so for example, I've used a snippet of your code with correct indentation to help reading:
Code:
Do
    For i = 1 To 10000
        Line Input [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , x
        xStart = False
        If Left(x, 5) = "Plate" Or Left(x, 5) = "Eleme" Then
            Print [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=2"]#2[/URL] , x
            Line Input [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , x
            a$ = x
            For j = 1 To 12
                Line Input [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , x
            Next j
        End If
    Next i
Loop
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,223,604
Messages
6,173,315
Members
452,510
Latest member
RCan29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top