Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default disable sheet while processing

I have a sort sub() that takes some time to complete. Running it
requires that I remove protection for the sheet, unhide rows and blah
blah.

Is there anyway to keep a user's hands off the workbook while this
runs? My impression is that the mouse is on one leg while all this
happens, but I'm not sure just what it can get away with. Que up
clicks and make a mess? This sheet is so busy I'd keep it all locked
up if I could.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default disable sheet while processing

You can use
application.screenupdating=false
code
application.sceenupdating=true
OR, it may NOT be necessary to unprotectunhide rowsselect,etc
show your code.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"cate" wrote in message
...
I have a sort sub() that takes some time to complete. Running it
requires that I remove protection for the sheet, unhide rows and blah
blah.

Is there anyway to keep a user's hands off the workbook while this
runs? My impression is that the mouse is on one leg while all this
happens, but I'm not sure just what it can get away with. Que up
clicks and make a mess? This sheet is so busy I'd keep it all locked
up if I could.

Thank you.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default disable sheet while processing

On Nov 23, 5:31*pm, "Don Guillett" wrote:
You can use
application.screenupdating=false
code
application.sceenupdating=true
OR, it may NOT be necessary to unprotectunhide rowsselect,etc
show your code.


Set mySheet = Application.ThisWorkbook.Worksheets("ChiralV")
mySheet.Unprotect
mySheet.Range("F:J").EntireColumn.Hidden = False

With mySheet
Set rg = .Range(.Range("n_rfpx_datarowfirst"), .Range
("n_rfpx_datarowlast"))
End With

If country_direction = 1 Then
With rg
.Sort Key1:=.Columns(8), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Else
With rg
.Sort Key1:=.Columns(9), Order1:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End If

mySheet.Range("F:J").EntireColumn.Hidden = True
mySheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default disable sheet while processing

About the only thing a user could do while the code is running that would
cause a problem would be to press Alt + Ctrl + Delete, or Ctrl + Break to
stop the code. I don't believe that clicking the mouse or pressing keyboard
keys, other than those mentioned would interfere once the code is running.
Although the sheet is unprotected, the macro has control until it completes.
Since you protect the sheet again before exiting the macro, you should not
have a problem. But if you have idiots in the area who are malicious in
nature, no amount of protection will keep them from sabotaging your work.



"cate" wrote in message
...
On Nov 23, 5:31 pm, "Don Guillett" wrote:
You can use
application.screenupdating=false
code
application.sceenupdating=true
OR, it may NOT be necessary to unprotectunhide rowsselect,etc
show your code.


Set mySheet = Application.ThisWorkbook.Worksheets("ChiralV")
mySheet.Unprotect
mySheet.Range("F:J").EntireColumn.Hidden = False

With mySheet
Set rg = .Range(.Range("n_rfpx_datarowfirst"), .Range
("n_rfpx_datarowlast"))
End With

If country_direction = 1 Then
With rg
.Sort Key1:=.Columns(8), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Else
With rg
.Sort Key1:=.Columns(9), Order1:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End If

mySheet.Range("F:J").EntireColumn.Hidden = True
mySheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable View Code for Sheet? Lostguy Excel Programming 1 February 22nd 09 10:13 PM
disable tab function on sheet tab johnny Excel Discussion (Misc queries) 4 April 19th 08 04:27 PM
Auto Disable Macros on new sheet DDub207 Excel Programming 5 July 31st 07 01:54 PM
Disable sheet copy/move Casper[_2_] Excel Programming 5 March 3rd 06 05:23 PM
Processing code on wrong sheet Jeff Klein Excel Programming 1 January 3rd 05 06:38 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"