Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Prevent edit of cells

Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Prevent edit of cells

ActiveSheet.Unprotect Password:="password"

(your current code)

ActiveSheet.Protect Password:="password"
Else: MsgBox "The cell can not be edited"
End If
End Sub

Protect the sheet with the password you have mentioned in the code.

hope this helps
Thanks.


"Freshman" wrote in message
...
Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be
edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Prevent edit of cells

Hi Gary,

I'll try the code. Thanks.

"Gary" wrote:

ActiveSheet.Unprotect Password:="password"

(your current code)

ActiveSheet.Protect Password:="password"
Else: MsgBox "The cell can not be edited"
End If
End Sub

Protect the sheet with the password you have mentioned in the code.

hope this helps
Thanks.


"Freshman" wrote in message
...
Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be
edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 168
Default Prevent edit of cells

Hello,

1. Unlock and unprotect all cells (Ctrl-A, then Ctrl-1, Protection
tab, uncheck 'Locked' and 'Hidden')
2. Select the formula cells in columns B&C, hit Ctrl-1, Protection
tab, check 'Locked' and 'Hidden')
3. Protect your worksheet

An added bonus: the formulas will be hidden so nobody can see what
calculations you are making.


HTH,
JP


On Oct 30, 4:13 am, Freshman
wrote:
Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Prevent edit of cells

Hi JP,

Thanks for your reply.

However, may be you misunderstood my question. I know how to protect cells
and a worksheet. My problem is, when I protect the cells in column B & C
which are used to show auto current dates and times by a macro, the macro
will not work and the dates and times will not be shown in protected cells.

Thanks & regards.

"JP" wrote:

Hello,

1. Unlock and unprotect all cells (Ctrl-A, then Ctrl-1, Protection
tab, uncheck 'Locked' and 'Hidden')
2. Select the formula cells in columns B&C, hit Ctrl-1, Protection
tab, check 'Locked' and 'Hidden')
3. Protect your worksheet

An added bonus: the formulas will be hidden so nobody can see what
calculations you are making.


HTH,
JP


On Oct 30, 4:13 am, Freshman
wrote:
Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 168
Default Prevent edit of cells

Ah ok, what you need to do is protect the worksheet with your macro
like this:

Sheets(1).Protect Password:="Secret", UserInterFaceOnly:=True


The "userinterfaceonly" property will allow your macro to edit a
protected worksheet.


HTH,
JP


On Oct 31, 3:33 am, Freshman
wrote:
Hi JP,

Thanks for your reply.

However, may be you misunderstood my question. I know how to protect cells
and a worksheet. My problem is, when I protect the cells in column B & C
which are used to show auto current dates and times by a macro, the macro
will not work and the dates and times will not be shown in protected cells.

Thanks & regards.



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
prevent cells highlighting john tempest Excel Discussion (Misc queries) 0 May 12th 06 06:17 PM
can i prevent duplications in cells Jackie Excel Worksheet Functions 6 April 22nd 06 07:52 PM
Allow Edit Prevent Delete LearningExcel Excel Worksheet Functions 1 December 23rd 05 03:06 AM
Lock Cells to Prevent Changes In Calif Excel Discussion (Misc queries) 4 September 14th 05 05:07 PM
How do I prevent users to delete a worksheet, but allow to edit? [email protected] Excel Discussion (Misc queries) 2 September 1st 05 08:37 PM


All times are GMT +1. The time now is 03:54 PM.

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

About Us

"It's about Microsoft Excel"