Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Macro will not work in protected Excel 2003 Worksheet

Columns D, I , and J are locked (Although my Macro only has to do with B, I,
and J). When I protect the sheet so that only unlocked cells can be selected
and edited my macro will not work.

What do I need to do? This form will be going out to other employees and I
don't want it to be difficult for them and I am protecting it from them for a
reason, obviously;).

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect([B:B], Target) Is Nothing Then
Application.EnableEvents = False
Cells(Target.Row, 9) = Date
If Range("J" & Target.Row).Value = "" Then
Cells(Target.Row, 10) = Now
End If
Application.EnableEvents = True
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Macro will not work in protected Excel 2003 Worksheet

In situations like that, I use the UserInterfaceOnly parameter on the
Protect statement. E.g.,

Worksheets(1).Protect password:="abc",UserInterfaceOnly:=True

With UserInterfaceOnly set to True, VBA code can do anything, regardless of
protection setting. The protection applies only to actions taken by the user
(e.g., by the keyboard or mouse). The UserInterfaceOnly property isn't
persistent, so it needs to be set with code with the workbook opens.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"LiveUser" wrote in message
...
Columns D, I , and J are locked (Although my Macro only has to do with B,
I,
and J). When I protect the sheet so that only unlocked cells can be
selected
and edited my macro will not work.

What do I need to do? This form will be going out to other employees and I
don't want it to be difficult for them and I am protecting it from them
for a
reason, obviously;).

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect([B:B], Target) Is Nothing Then
Application.EnableEvents = False
Cells(Target.Row, 9) = Date
If Range("J" & Target.Row).Value = "" Then
Cells(Target.Row, 10) = Now
End If
Application.EnableEvents = True
End If
End Sub


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
UDF doesn't work on a protected sheet in Excel 2003 CarpeDiem Excel Discussion (Misc queries) 1 February 10th 09 08:49 PM
UDF doesn't work on a protected sheet in Excel 2003 CarpeDiem Excel Discussion (Misc queries) 0 February 10th 09 08:13 PM
UDF doesn't work on a protected sheet in Excel 2003 CarpeDiem Excel Discussion (Misc queries) 0 February 10th 09 08:13 PM
How to sort protected worksheet in Excel 07? Doesn't work. jbachaud Excel Worksheet Functions 1 June 1st 07 06:43 PM
Enable filter to work in a protected sheet from Excel 2003 to 2000 Metallo[_3_] Excel Programming 2 November 26th 04 03:58 PM


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