Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Protect Cells After Input - help with macro

I want to protect cells once the user has entered data. I have the following
macro which I think fails to work because some of the cells in the Target
Range are merged

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRng As Range
Dim myCell As Range
Set myRng = Me.Range("A11:K33,")
If Intersect(Target, myRng) Is Nothing Then
Exit Sub
End If
Me.Unprotect Password:="al"
For Each myCell In Target.Cells
If myCell.Value = "" Then
Else
myCell.Locked = True
End If
Next myCell
Me.Protect Password:="al"
End Sub

Thanks for any help or suggestions.

Andrew

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
unable to protect cells in macro sheet b/c runtime error 1004 rldjda Excel Worksheet Functions 1 March 20th 08 09:28 PM
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 06:23 AM
Setting of input cells as blue font and formula cells as black fon Sunnyskies Excel Discussion (Misc queries) 2 May 14th 07 05:27 PM
Protect macro ST Excel Discussion (Misc queries) 1 June 6th 06 06:26 PM
Macro to move to specified cells, pause for input at each? Pete in Montrose Excel Discussion (Misc queries) 1 March 5th 05 07:18 PM


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