Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
prevent cells highlighting | Excel Discussion (Misc queries) | |||
can i prevent duplications in cells | Excel Worksheet Functions | |||
Allow Edit Prevent Delete | Excel Worksheet Functions | |||
Lock Cells to Prevent Changes | Excel Discussion (Misc queries) | |||
How do I prevent users to delete a worksheet, but allow to edit? | Excel Discussion (Misc queries) |