Exit Function inside With-End With block

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Can't see why not.....but you didn't ell us much either !
 
Upvote 0
Code:
With Something
Do stuff
If some condition then exit Function
End With

If this Exits you're never hitting the End With.
It works, but may not be a 'good' thing to do. But as you're leaving the Function, it may not matter.
Just wanted to be sure.
 
Upvote 0
Maybe make sure before you exit, you re-enabled anything that may have been turned off, like
Screenupdating
displayalerts
enableevents
calculation......etc
that would normally be re-enabled at the end of the sub if it ran to completion
 
Upvote 0
A With...End With isn't a control structure so I don't see if you 'exit' the function within one you aren't really going to be affecting anything.

Mind you, Michael has a good point regarding ScreenUpdating etc. but that would apply any time you were exiting something 'prematurely'.
 
Last edited:
Upvote 0
Thank you, will carry on then. There's no screen updating or other hazards at the time.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,699
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top