ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compiler Error (https://www.excelbanter.com/excel-programming/420964-compiler-error.html)

Chad[_3_]

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




Barb Reinhardt

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





Chad[_3_]

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







JLGWhiz

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









All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com