Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The science behind the With...End With structure is pretty simple:
1) The "." is used as shorthand for whatever follows the With, so With Worksheets("Sheet1") .Range("J2", .Range("J2").End(xlDown)).Copy End With is shorter, and perhaps faster to write than Worksheets("Sheet1").Range("J2", _ Worksheets("Sheet1").Range("J2").End(xlDown)).Copy 2) In the second example, the Worksheets("Sheet1") reference has to be resolved twice. Using With...End With, the worksheets("Sheet1") reference is only resolved once. Resolving object (Workbook, Worksheet, Range, etc.) references is very time and resource consuming, so the With...End With structure is also more efficient any time you have more than one reference to an object. In article , "Joe 90" wrote: Your extra "dots" worked a treat, and this will help me enormously with my coding. just wish I properly understood the science behind it, although I see what you say about the second range not being qualified. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why does this code not work? | Excel Discussion (Misc queries) | |||
Why this code is not work? | Excel Worksheet Functions | |||
Why my code do not work : - ( | Excel Programming | |||
Why my code do not work : - ( | Excel Programming | |||
Why my code do not work : - ( | Excel Programming |