• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How many nested With...End with can be process in VBA?

Dear Sirs,

How many nested With End with actions possible through Excel VBA?

if possible, then how to track?, what should used put as remark on every nested With end with statement?

Hope there are found some fundamental & advance, pointed towards, need to deeply understand points about With End With statement.

Regards,

Chirag Raval
 
There is, as far as I know, no limit. From the point of view of maintenance, anything more than about 3 levels is unpleasant.

Why do you ask?
 
Dear Sir @Debaser,

Thanks for reply.
& yes , you are seems right, because more then 3 nesting , hard to maintain .

Because when open more then 3 workbooks , if we are on 1st , there are we usually say or use "With activeworkbook", but after jump to another , use also there another With..End with , & then jump to another ....so in point of first,
we must release it with "End With " somewhere in code, but on which point ? this confused the matter.

Regards,

Chirag Raval
 
Why do they need to be nested at all? If they refer to separate workbooks, I see no reason to nest them inside each other. Nesting With blocks should only really be done when you want to use a With block referring to a property of the prior With block. For example if you have a Range object in a With block and then need to alter several font properties, like this:

Code:
With Range("A1")
    With .Font
        .Bold = True
        .Size = 12
    End With
    
    .Value = "Look at me, I'm bold!"
End With
 
Dear Sir @Debaser ,

Thank you very much for focus on core concept of nesting "With... End With".
Hope there are further something important to know about With..End with may be found.

Regards,

Chirag Raval
 
Back
Top