Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compile Errors in Excel VBasic


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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Compile Errors in Excel VBasic


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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default Compile Errors in Excel VBasic


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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel & MS Query caused compile errors Simon Shaw Excel Programming 17 June 5th 09 04:59 PM
Compile Errors with Different versions of Excel PStephens Excel Discussion (Misc queries) 2 March 14th 05 04:27 PM
compile errors johnny Excel Discussion (Misc queries) 1 February 24th 05 11:49 PM
Excel 97 Macro Compile Errors Simon[_15_] Excel Programming 1 May 10th 04 01:37 PM
Compile Errors Patricia[_3_] Excel Programming 2 October 17th 03 11:48 AM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"