PC Review


Reply
Thread Tools Rate Thread

Compile Errors in Excel VBasic

 
 
n250jg
Guest
Posts: n/a
 
      26th Jun 2009

I've been running a macro to sort data in Excel but just recently I'm getting
Compile errors such as "loop without do" and "next without for" and "block if
without end if", but obviously that is not the case. This was running fine
before. Any suggestions?

 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      26th Jun 2009

Hi,

It wouldn't have run previously with this error because this type of error
stops the code compiling so maybe it got accidentally altered. Post your code
and someone will help.

Mike

"n250jg" wrote:

> I've been running a macro to sort data in Excel but just recently I'm getting
> Compile errors such as "loop without do" and "next without for" and "block if
> without end if", but obviously that is not the case. This was running fine
> before. Any suggestions?
>

 
Reply With Quote
 
JLatham
Guest
Posts: n/a
 
      26th Jun 2009

As Mike H said, wouldn't have run earlier if any of those were true then.

Are all of these errors coming from a single routine or from several
different sections of the code? Typically if you have a bunch of nested
loops and ifs, the debugger reports the error as being in the outermost block
even though that may not be true. That is, if you have
Sub testerrors()
Dim X As Integer
For X = 1 To 10
If X = 4 Then
MsgBox "X is 4"
Next
End Sub

will give you a "Next Without For" error indication even though it is really
the End If that is the missing element.



"n250jg" wrote:

> I've been running a macro to sort data in Excel but just recently I'm getting
> Compile errors such as "loop without do" and "next without for" and "block if
> without end if", but obviously that is not the case. This was running fine
> before. Any suggestions?
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Visual Basic (Compile Errors) Howard Cross Microsoft Excel Discussion 2 21st Jun 2007 06:28 PM
Compile Errors with Different versions of Excel =?Utf-8?B?UFN0ZXBoZW5z?= Microsoft Excel Misc 2 14th Mar 2005 04:27 PM
Excel 97 Macro Compile Errors Simon Microsoft Excel Programming 1 10th May 2004 01:37 PM
Compile errors when starting/stopping Excel Ron Ronhovde Microsoft Excel Misc 1 27th Jan 2004 02:24 AM
Excel and Word 2003 VB compile errors ChasR Microsoft Excel Crashes 2 31st Dec 2003 11:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:58 PM.