Compiler Error

C

Chad

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").PasteSpecial Paste:=xlValues
End Sub
 
B

Barb Reinhardt

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.
 
C

Chad

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
 
J

JLGWhiz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top