Compile or not to compile?


Posted by Dorine on January 22, 2002 1:58 PM

A macro returned an error message to a user because the end of the rows was reached. After a quick look it turned out that the amount of rows were set to small. On my desk I set the amount of rows to a higher limit. But the user still has the same error. Is it necessary to compile a macro?

Maybe, a stupid question but I am new to excel VBA script.



Posted by Joe Was on January 22, 2002 2:56 PM

No, Excel uses VBA an extended version of VB. You do not compile, just save. Your Error is due to not accounting for what the code is doing. You need to trap the end of the row situation. What it is telling you is that it did what you told it to do and didd not find what it was looking for!

Try trapping your error.

If x <> "" then _
Your code
Else GoTo Err
End
Err:
End Sub

This way if your code does not find anything it will just do nothing and end with no message. JSW