ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Best Practice (https://www.excelbanter.com/excel-programming/353753-best-practice.html)

Ardus Petus

Best Practice
 
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a performance issue

TIA

--
AP



Chip Pearson

Best Practice
 
Using the [] method is slower than second method. I always use
the second method, though that is a matter of personal
preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a
performance issue

TIA

--
AP





Ardus Petus

Best Practice
 
I thought VBA was compiled before execution.
If true, how come one method is faster than the other?

TIA

--
AP

"Chip Pearson" a écrit dans le message de
...
Using the [] method is slower than second method. I always use
the second method, though that is a matter of personal
preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a
performance issue

TIA

--
AP







Chip Pearson

Best Practice
 
The contents of the [] characters are evaluated at run time.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ardus Petus" wrote in message
...
I thought VBA was compiled before execution.
If true, how come one method is faster than the other?

TIA

--
AP

"Chip Pearson" a écrit dans le message de
...
Using the [] method is slower than second method. I always use
the second method, though that is a matter of personal
preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a
performance issue

TIA

--
AP









Ardus Petus

Best Practice
 
Thanks for that definite response!

--
AP

"Chip Pearson" a écrit dans le message de
...
The contents of the [] characters are evaluated at run time.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ardus Petus" wrote in message
...
I thought VBA was compiled before execution.
If true, how come one method is faster than the other?

TIA

--
AP

"Chip Pearson" a écrit dans le message de
...
Using the [] method is slower than second method. I always use
the second method, though that is a matter of personal
preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a
performance issue

TIA

--
AP











Don Guillett

Best Practice
 
I sometimes use [] because of brevity. Harlan always jumps on me when I do
it.

--
Don Guillett
SalesAid Software

"Chip Pearson" wrote in message
...
Using the [] method is slower than second method. I always use the second
method, though that is a matter of personal preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a performance
issue

TIA

--
AP







Chip Pearson

Best Practice
 
Harlan always jumps on me when I do it.

Why am I not surprised?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Don Guillett" wrote in message
...
I sometimes use [] because of brevity. Harlan always jumps on me
when I do it.

--
Don Guillett
SalesAid Software

"Chip Pearson" wrote in message
...
Using the [] method is slower than second method. I always use
the second method, though that is a matter of personal
preference.


"Ardus Petus" wrote in message
...
Since I found out yo may write
[Sheet2!A1:b2].value
instead of :
Worksheets("Sheet2").Range("A1:B2").Value

I would like to know wether this is bad practice or just a
performance issue

TIA

--
AP









davidm

Best Practice
 

Following conclusions reached on the use [], does the same apply to
using
(for example) [Sum(A1:A100)] instead of
Application.Sum(Range("A1:A100") or
WorkSheetFunction.Sum(Range("A1:A100")?

Thanks

David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=514190



All times are GMT +1. The time now is 03:10 AM.

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