ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   which is better? (https://www.excelbanter.com/excel-programming/408791-better.html)

Gregor[_3_]

which is better?
 
From a performance stand point, which of these is better:

Range("A6:D6").Font.Bold = True
Range("A6:D6").HorizontalAlignment = xlCenter

or

Range("6:6").Font.Bold = True
Range("6:6").HorizontalAlignment = xlCenter

(There will never be any data beyond column D).

I'm using 2007 but keeping the workbook in computability mode.


Thanks
-Gregor

Per Jessen

which is better?
 
Hi Gregor

I would rather do it like this:

With Range("A6:D6")
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With

Regards,
Per

"Gregor" skrev i meddelelsen
...
From a performance stand point, which of these is better:

Range("A6:D6").Font.Bold = True
Range("A6:D6").HorizontalAlignment = xlCenter

or

Range("6:6").Font.Bold = True
Range("6:6").HorizontalAlignment = xlCenter

(There will never be any data beyond column D).

I'm using 2007 but keeping the workbook in computability mode.


Thanks
-Gregor



Bob Umlas, Excel MVP

which is better?
 
I don't think there's a difference, but THIS would be better still:
With Range("A6:D6")
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With

Bob Umlas
Excel MVP

"Gregor" wrote:

From a performance stand point, which of these is better:

Range("A6:D6").Font.Bold = True
Range("A6:D6").HorizontalAlignment = xlCenter

or

Range("6:6").Font.Bold = True
Range("6:6").HorizontalAlignment = xlCenter

(There will never be any data beyond column D).

I'm using 2007 but keeping the workbook in computability mode.


Thanks
-Gregor



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

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