ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newb VBA question (https://www.excelbanter.com/excel-programming/406582-newb-vba-question.html)

[email protected]

Newb VBA question
 
How do you return from a sub early? I have code that looks like

If x < 5 Then
Return
End If

I get a Return without GoSub error. Coming from a C++ background so I
have no idea what is going on. Thanks.

Rick Rothstein \(MVP - VB\)[_1320_]

Newb VBA question
 
If it is a Sub, then use Exit Sub.

If it is a function, then use Exit Function.

Rick


wrote in message
...
How do you return from a sub early? I have code that looks like

If x < 5 Then
Return
End If

I get a Return without GoSub error. Coming from a C++ background so I
have no idea what is going on. Thanks.




All times are GMT +1. The time now is 01:04 AM.

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