Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Problem with Worksheet_Activate event

A workbook as two sheets: Master and Details. The requirement is that
the data entry in the Details worksheet is not to be allowed unless
the Master worksheet is protected. To achieve this the following code
was written in the Worksheet_activate event of the Details sheet.

Private Sub Worksheet_Activate()

If Worksheets("Master").ProtectContents < True Then MsgBox "Please
protect 'Master' sheet": Worksheets("Master").Activate
End Sub

When the Details sheet is activated without the Master sheet being
protected, there is an endless loop. How do I resolve the issue?

Any other ideas to achieve this would also be welcome.

Thanks in advance for all the help.

Regards,
Raj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Problem with Worksheet_Activate event

instead of doing a test and reporting to user why not just protect the
required sheet when Details sheet is activated?

Private Sub Worksheet_Activate()
Worksheets("Master").Protect Contents:=True
End Sub
--
jb


"Raj" wrote:

A workbook as two sheets: Master and Details. The requirement is that
the data entry in the Details worksheet is not to be allowed unless
the Master worksheet is protected. To achieve this the following code
was written in the Worksheet_activate event of the Details sheet.

Private Sub Worksheet_Activate()

If Worksheets("Master").ProtectContents < True Then MsgBox "Please
protect 'Master' sheet": Worksheets("Master").Activate
End Sub

When the Details sheet is activated without the Master sheet being
protected, there is an endless loop. How do I resolve the issue?

Any other ideas to achieve this would also be welcome.

Thanks in advance for all the help.

Regards,
Raj

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Problem with Worksheet_Activate event

That doesn't loop for me. Is there code in Master as well?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Raj" wrote in message
...
A workbook as two sheets: Master and Details. The requirement is that
the data entry in the Details worksheet is not to be allowed unless
the Master worksheet is protected. To achieve this the following code
was written in the Worksheet_activate event of the Details sheet.

Private Sub Worksheet_Activate()

If Worksheets("Master").ProtectContents < True Then MsgBox "Please
protect 'Master' sheet": Worksheets("Master").Activate
End Sub

When the Details sheet is activated without the Master sheet being
protected, there is an endless loop. How do I resolve the issue?

Any other ideas to achieve this would also be welcome.

Thanks in advance for all the help.

Regards,
Raj



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Problem with Worksheet_Activate event

The requirement is like this. The user has to select values in two
cells and click on a worksheet commandbutton to lock the cells.
Clicking on the button will lock the cells and protect the sheet. In
case the user has not done that, he should not be allowed to do data
entry in the Details sheet. The code is prevent the user from doing
data entry in the Details sheet unless he locks the cells and protects
the master sheet.

The Master sheet has code in it (for the button) as well as some other
code.

Regards,
Raj




On May 22, 7:40*pm, "Bob Phillips" wrote:
That doesn't loop for me. Is there code in Master as well?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Raj" wrote in message

...

A workbook as two sheets: Master and Details. The requirement is that
the data entry in the Details worksheet is not *to be allowed unless
the Master worksheet is protected. To achieve this the following code
was written in the Worksheet_activate event of the Details sheet.


Private Sub Worksheet_Activate()


If Worksheets("Master").ProtectContents < True Then MsgBox "Please
protect 'Master' sheet": Worksheets("Master").Activate
End Sub


When the Details sheet is activated without the Master sheet being
protected, there is an endless loop. How do I resolve the issue?


Any other ideas to achieve this would also be welcome.


Thanks in advance for all the help.


Regards,
Raj


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
Worksheet_Activate greg Excel Programming 2 September 26th 06 01:24 PM
Worksheet_Activate event question Barb Reinhardt Excel Programming 0 June 19th 06 06:32 PM
Worksheet_Activate event clears clipboard? Andibevan[_2_] Excel Programming 5 June 7th 05 03:09 PM
Worksheet_Activate Pozzo Excel Programming 5 June 7th 04 07:39 PM
Worksheet_Activate Jim Carlock[_2_] Excel Programming 2 September 25th 03 12:47 AM


All times are GMT +1. The time now is 07:28 PM.

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

About Us

"It's about Microsoft Excel"