By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 833 - if .Cells(i,j) ' referencing the with stmt


Save Time and make Code more readable.

if .Cells(i,j) ' referencing the with stmt

The dot "." or period can be used with a with statement.

The following code can be simplified


Some.Long.Object.Name.Cells(1,1) = "blah"
Some.Long.Object.Name.Cells(1,2) = "blah1"
Some.Long.Object.Name.Cells(1,3) = "blah2"
Some.Long.Object.Name.Cells(1,4) = "blah3"




can be made more readable with


With Some.Long.Object.Name
    .Cells(1,1) = "blah"
    .Cells(1,2) = "blah"
    .Cells(1,3) = "blah"
    .Cells(1,4) = "blah"
End With



   Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit