Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default event after worksheet unprotect

Here is sample code:

If Worksheets("Sheet1").Range("E5").Value = "1" Then
Worksheets("Sheet1").Protect
Else
If Worksheets("Sheet1").Range("E5").Value = "2" Then
Worksheets("Sheet1").Unprotect
Worksheets("Sheet1").Range("J8").Value = "111"
End If
End If

When I choose the value 2 in the dropdown list of range E5, it can
unprotect this worksheet. But, it doesn't execute the clause after
unprotect. However, after I click anything on this worksheet, the
clause after unprotect runs(111 appears on the range J8). I am confused
about this. Do you know how to fix this problem?Thank you!

Best Regards

Sam

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default event after worksheet unprotect

I see no reason why what you have posted shouldn't work. The syntax could be
cleaned up a bit but it should not affect the actual execution... In your
title you mentioned "event". Is this code executed based on an event?

with Worksheets("Sheet1")
If .Range("E5").Value = "1" Then
.Protect
ElseIf .Range("E5").Value = "2" Then
.Unprotect
.Range("J8").Value = "111"
End If
end with

--
HTH...

Jim Thomlinson


"sam" wrote:

Here is sample code:

If Worksheets("Sheet1").Range("E5").Value = "1" Then
Worksheets("Sheet1").Protect
Else
If Worksheets("Sheet1").Range("E5").Value = "2" Then
Worksheets("Sheet1").Unprotect
Worksheets("Sheet1").Range("J8").Value = "111"
End If
End If

When I choose the value 2 in the dropdown list of range E5, it can
unprotect this worksheet. But, it doesn't execute the clause after
unprotect. However, after I click anything on this worksheet, the
clause after unprotect runs(111 appears on the range J8). I am confused
about this. Do you know how to fix this problem?Thank you!

Best Regards

Sam


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default event after worksheet unprotect

It is one more event after unprotected that specific worksheet, like
enable some grayed option buttons.
obj.Object.Enabled = False
However, I need to click the worksheet again to make it happen. I don't
know why the code couldn't execute it directly.Do you have some idea
regarding this issue?

Regards

Sam

Jim Thomlinson wrote:
I see no reason why what you have posted shouldn't work. The syntax could be
cleaned up a bit but it should not affect the actual execution... In your
title you mentioned "event". Is this code executed based on an event?

with Worksheets("Sheet1")
If .Range("E5").Value = "1" Then
.Protect
ElseIf .Range("E5").Value = "2" Then
.Unprotect
.Range("J8").Value = "111"
End If
end with

--
HTH...

Jim Thomlinson


"sam" wrote:

Here is sample code:

If Worksheets("Sheet1").Range("E5").Value = "1" Then
Worksheets("Sheet1").Protect
Else
If Worksheets("Sheet1").Range("E5").Value = "2" Then
Worksheets("Sheet1").Unprotect
Worksheets("Sheet1").Range("J8").Value = "111"
End If
End If

When I choose the value 2 in the dropdown list of range E5, it can
unprotect this worksheet. But, it doesn't execute the clause after
unprotect. However, after I click anything on this worksheet, the
clause after unprotect runs(111 appears on the range J8). I am confused
about this. Do you know how to fix this problem?Thank you!

Best Regards

Sam



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
Unprotect a worksheet Mayumdwl Excel Worksheet Functions 1 April 21st 09 12:30 AM
Unprotect a worksheet FRAZZLED New Users to Excel 0 May 30th 06 05:06 PM
Sheet unprotect event Vlado Sveda Excel Programming 2 August 31st 05 03:13 PM
Event Procedures: Event on Worksheet to fire Event on another Worksheet Kathryn Excel Programming 2 April 7th 04 07:35 PM


All times are GMT +1. The time now is 10:48 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"