View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Restrict Sort on a Particular Sheet

Hi Ritesh

This are sheet events
The code will disable the Sort controls when you activate the
worksheet and enabled them when you deacitvate the Sheet

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

If you copy the events in Sheet2 for example then you can use this
events in the ThisWorkbook module to be sure that the controls are working
if you go to a other file or save the file
It will select a other sheet so the deactivate event will run


Right click on the Excel icon next to File in the menubar
And choose View code

You are now in the Thisworkbook module
Paste the Event in this place
Alt-Q to go back to Excel

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisWorkbook.Sheets("Sheet1").Activate
End Sub

Private Sub Workbook_Deactivate()
ThisWorkbook.Sheets("Sheet1").Activate
End Sub


Read Chip Pearson's site about Events
http://www.cpearson.com/excel/events.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ritesh" wrote in message ...
Thank you so much...but I just wanted to clearify your
instructions...

Did you want me to put this Code in Sheet(Code) or in a
Module... and if you would please tell me what 1st part
and 2nd part does

Thanks again
Sincerely,
Ritesh

-----Original Message-----
Hi

Try this two events in the sheet module Ritesh

Private Sub Worksheet_Activate()
With Application.CommandBars("Standard")
.FindControl(ID:=210).Enabled = False
.FindControl(ID:=211).Enabled = False
End With
Application.CommandBars("Worksheet Menu

Bar").FindControl _
(ID:=928, Recursive:=True).Enabled = False
End Sub

Private Sub Worksheet_Deactivate()
With Application.CommandBars("Standard")
.FindControl(ID:=210).Enabled = True
.FindControl(ID:=211).Enabled = True
End With
Application.CommandBars("Worksheet Menu

Bar").FindControl _
(ID:=928, Recursive:=True).Enabled = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ritesh S" wrote

in message ...
I have created a sheet with all the numbers at specific
location and i am working on writing a code in VB to

find
the location of those numbers and Graph it.

What i am having trouble is to make is so that nobody

can
sort that one particular sheet...b/c that could cause

all
my graphs to mess up...

If anybody can help me I'd really appreciate it.

Thanks in advance...

Sincerely,
Ritesh



.