Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Compiler Error

Hi All,

I was writing the following code. I copied a chunk of code into the
FilterABAAssays() sub and when I went to compile it, I got the following
error

Compile error:
Only comments may appear after End Sub, End Function, or End Property

I looked everywhere to find anything after my sub ends, but cannot see
anything

Code:

Option Explicit

Sub Main()
Call Getdata
Call Assays.LoadAssays
Call FilterABAAssays
End Sub

Sub Getdata()
fABA.Show
End Sub

Sub FilterABAAssays()
Dim NewBook As Workbook
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=ABAPit
Selection.AutoFilter Field:=3, Criteria1:=ABABench
Worksheets("Sheet1").UsedRange.Copy
Set NewBook = Workbooks.Add
NewBook.Worksheets("Sheet1").Range("A1").PasteSpec ial Paste:=xlValues
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Compiler Error

It looks like you've got some forms and other subs you're calling. Take a
look at the line it highlighted for a clue when you compile it.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Chad" wrote:

Hi All,

I was writing the following code. I copied a chunk of code into the
FilterABAAssays() sub and when I went to compile it, I got the following
error

Compile error:
Only comments may appear after End Sub, End Function, or End Property

I looked everywhere to find anything after my sub ends, but cannot see
anything

Code:

Option Explicit

Sub Main()
Call Getdata
Call Assays.LoadAssays
Call FilterABAAssays
End Sub

Sub Getdata()
fABA.Show
End Sub

Sub FilterABAAssays()
Dim NewBook As Workbook
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=ABAPit
Selection.AutoFilter Field:=3, Criteria1:=ABABench
Worksheets("Sheet1").UsedRange.Copy
Set NewBook = Workbooks.Add
NewBook.Worksheets("Sheet1").Range("A1").PasteSpec ial Paste:=xlValues
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Compiler Error

It was wierd. If I rearranged my subs, it always highlighted the last line
of the last sub. I deleted it all and retyped it, and it did the same
thing. The first sub would work, and the next failed.

After numerous attempts, the editor crashed. After killing the process and
reopening everything, it worked fine.

Should have tried closing everything down before asking for help.

Thanks
Chad

"Barb Reinhardt" wrote in message
...
It looks like you've got some forms and other subs you're calling. Take
a
look at the line it highlighted for a clue when you compile it.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Chad" wrote:

Hi All,

I was writing the following code. I copied a chunk of code into the
FilterABAAssays() sub and when I went to compile it, I got the following
error

Compile error:
Only comments may appear after End Sub, End Function, or End Property

I looked everywhere to find anything after my sub ends, but cannot see
anything

Code:

Option Explicit

Sub Main()
Call Getdata
Call Assays.LoadAssays
Call FilterABAAssays
End Sub

Sub Getdata()
fABA.Show
End Sub

Sub FilterABAAssays()
Dim NewBook As Workbook
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=ABAPit
Selection.AutoFilter Field:=3, Criteria1:=ABABench
Worksheets("Sheet1").UsedRange.Copy
Set NewBook = Workbooks.Add
NewBook.Worksheets("Sheet1").Range("A1").PasteSpec ial Paste:=xlValues
End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Compiler Error

Sometimes when I do a lot of revisions, I keep moving my code range downward.
The bottom of the range can be several linefeeds below what appears to be
the last line of code. If I did not happen to get the whole block of code
for a previous deletion, it could leave an entry several lines below where I
can see. The scroll bar slide tab is the give-away in a case like that, If
there is a big gap between the slide tab and the down arrow, I take ithe
slide tab all the way to the bottom to be sure I don't leave any dribbles.






"Chad" wrote:

It was wierd. If I rearranged my subs, it always highlighted the last line
of the last sub. I deleted it all and retyped it, and it did the same
thing. The first sub would work, and the next failed.

After numerous attempts, the editor crashed. After killing the process and
reopening everything, it worked fine.

Should have tried closing everything down before asking for help.

Thanks
Chad

"Barb Reinhardt" wrote in message
...
It looks like you've got some forms and other subs you're calling. Take
a
look at the line it highlighted for a clue when you compile it.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Chad" wrote:

Hi All,

I was writing the following code. I copied a chunk of code into the
FilterABAAssays() sub and when I went to compile it, I got the following
error

Compile error:
Only comments may appear after End Sub, End Function, or End Property

I looked everywhere to find anything after my sub ends, but cannot see
anything

Code:

Option Explicit

Sub Main()
Call Getdata
Call Assays.LoadAssays
Call FilterABAAssays
End Sub

Sub Getdata()
fABA.Show
End Sub

Sub FilterABAAssays()
Dim NewBook As Workbook
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=ABAPit
Selection.AutoFilter Field:=3, Criteria1:=ABABench
Worksheets("Sheet1").UsedRange.Copy
Set NewBook = Workbooks.Add
NewBook.Worksheets("Sheet1").Range("A1").PasteSpec ial Paste:=xlValues
End Sub







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
Compiler Error - Not an Appropriate Name pallaver Excel Discussion (Misc queries) 1 July 16th 08 02:20 AM
Compiler Error Bobzter100 Excel Discussion (Misc queries) 4 November 10th 07 11:02 AM
Help with compiler error Pank Mehta Excel Programming 1 March 11th 05 12:03 PM
Compiler Error Chris Excel Programming 2 December 9th 04 05:02 PM
VBA Compiler Error Cause Excel to Crash MWE[_12_] Excel Programming 3 January 26th 04 02:22 AM


All times are GMT +1. The time now is 06:56 PM.

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

About Us

"It's about Microsoft Excel"