View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sriram Sriram is offline
external usenet poster
 
Posts: 50
Default NEED HELP - How to disable a cell to restrict data entry

Dear Tom,

I want to know how to send the current working excel file using Microsoft
Outlook or some other means as an attachment to my email id automatically
whenever the file is being Closed.

Kindly let me know how to achieve this using excel macros.

Thanks and Regards,
Sriram Subramaniyan

----

"Tom Ogilvy" wrote:

Sounds like you are already familiar with the Change Event.

(right click on the sheet tab and select view code, then place this in the
resulting module if you don't have one or add similar code to your existing
change event.)

Private Sub Worksheet_Change(ByVal Target As Range)
If target.count 1 then exit sub
if target.column = 3 then
if trim(lcase(target.value)) = "completed" then
me.unprotect password:="ABC"
target.locked = True
me.Protect password:="ABC"
end if
End if
End Sub

Since your sheet will be protected, make sure that any cells that you want
to allow entries in are formatted as Unlocked. Change Column = 3 to
reflect the column number of the column where you want this behavior.

--
Regards,
Tom Ogilvy