ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lock view (https://www.excelbanter.com/excel-programming/421190-lock-view.html)

Ben in CA[_2_]

Lock view
 
Hi,

In other programming environments, you can speed things up by not performing
formating and calculations "live".

For instance, if I run the following script:

Columns("U:U").Select
Selection.Clear
Range("T1").Select
Columns("V:V").Select
Selection.Clear
Range("T1").Select
Columns("W:W").Select
Selection.Clear
Columns("T:X").Select
Selection.NumberFormat = "$#,##0.00" ' Make Currencey format
Range("U1").Select ' Select a signal cell to avoid confusion

when a form button is pressed, the page flashes, etc. while it does the
changes.

In Excel, should the screen be "locked" and then "unlocked" before and after
the script? If so, how can this be done?

Thanks for any suggestions!

Ben

Gord Dibben

Lock view
 
Application.ScreenUpdating = False

'your code

Application.ScreenUpdating = True

But........doing away with all those extraneous "selects" would be better.

Sub dothings()
Columns("U:W").Clear
Columns("T:X").NumberFormat = "$#,##0.00"
Range("U1").Select
End Sub


Gord Dibben MS Excel MVP

On Thu, 11 Dec 2008 13:54:04 -0800, Ben in CA
wrote:

Hi,

In other programming environments, you can speed things up by not performing
formating and calculations "live".

For instance, if I run the following script:

Columns("U:U").Select
Selection.Clear
Range("T1").Select
Columns("V:V").Select
Selection.Clear
Range("T1").Select
Columns("W:W").Select
Selection.Clear
Columns("T:X").Select
Selection.NumberFormat = "$#,##0.00" ' Make Currencey format
Range("U1").Select ' Select a signal cell to avoid confusion

when a form button is pressed, the page flashes, etc. while it does the
changes.

In Excel, should the screen be "locked" and then "unlocked" before and after
the script? If so, how can this be done?

Thanks for any suggestions!

Ben



Ben in CA[_2_]

Lock view
 
Thanks Gord - Works great, and that's a good suggestion about the
consolidation. (As you can tell, I'm rather new at this!)

Ben

"Gord Dibben" wrote:

Application.ScreenUpdating = False

'your code

Application.ScreenUpdating = True

But........doing away with all those extraneous "selects" would be better.

Sub dothings()
Columns("U:W").Clear
Columns("T:X").NumberFormat = "$#,##0.00"
Range("U1").Select
End Sub


Gord Dibben MS Excel MVP

On Thu, 11 Dec 2008 13:54:04 -0800, Ben in CA
wrote:

Hi,

In other programming environments, you can speed things up by not performing
formating and calculations "live".

For instance, if I run the following script:

Columns("U:U").Select
Selection.Clear
Range("T1").Select
Columns("V:V").Select
Selection.Clear
Range("T1").Select
Columns("W:W").Select
Selection.Clear
Columns("T:X").Select
Selection.NumberFormat = "$#,##0.00" ' Make Currencey format
Range("U1").Select ' Select a signal cell to avoid confusion

when a form button is pressed, the page flashes, etc. while it does the
changes.

In Excel, should the screen be "locked" and then "unlocked" before and after
the script? If so, how can this be done?

Thanks for any suggestions!

Ben





All times are GMT +1. The time now is 10:01 PM.

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