On Feb 5, 9:44 am, Gord Dibben <gorddibbATshawDOTca> wrote:
> That is all one line which got line-wrapped in the posting.
>
> Add a continuation character as so........note the <space> between ) _
>
> If MsgBox("Do you want to edit cell" & ECell.Address(False, False) _
> & "?", vbYesNo) = vbNo Then Exit Sub
>
> Gord Dibben MS Excel MVP
>
> On Mon, 4 Feb 2008 20:20:39 -0800 (PST), SNM <snigdhahatesma...@gmail.com>
> wrote:
>
> >Hi,
>
> >Thanks so much for your help. I tried it out but two lines of the
> >code appear in red and show some compilation error. As a result it
> >wasn't working. Can you please check this.
> >__________
> >If MsgBox("Do you want to edit cell" & ECell.Address(False, False) &
> >"?", vbYesNo) = vbNo Then Exit
> >Sub
> >____________
>
> >Thanks
> >SNM
>
> >On Feb 4, 9:51 pm, "Bernie Deitrick" <deitbe @ consumer dot org>
> >wrote:
> >> SNM,
>
> >> Insert a new worksheet into your workbook, and name it Record Sheet. InCellA1 enter "Date and
> >> Time", in B1 enter "User Name", and in C1 enter "Manually entered Value".
>
> >> Copy the code below, right-click the sheet tab with thecellthat you want to be able toedit,
> >> select "View Code" and paste the code into the window that appears. Change the address to thecell
> >> that you want to overwrite - in the code it is currently C4, set with the code line
>
> >> Set ECell = Range("C4")
>
> >> As written, this will only work with onecell, but can be modified to include many cells, if
> >> desired.
>
> >> Make sure that all the cells are locked, the sheet is passwordprotected, and.... give it a try.
> >> The record sheet will include the date/time, the username, and the value entered into thecell.
>
> >> HTH,
> >> Bernie
> >> MS Excel MVP
>
> >> Option Explicit
> >> Public myPW As String
> >> Public GoodPW As Boolean
> >> Public ECell As Range
> >> Private Sub Worksheet_Change(ByVal Target As Range)
> >> Dim myR As Long
> >> If GoodPW And Target.Address = ECell.Address Then
> >> Target.Parent.Unprotect myPW
> >> ECell.Locked = True
> >> With Worksheets("Record Sheet")
> >> myR = .Cells(Rows.Count, 1).End(xlUp)(2).Row
> >> .Cells(myR, 1).Value = Now
> >> .Cells(myR, 2).Value = Application.UserName
> >> .Cells(myR, 3).Value = ECell.Value
> >> End With
> >> Target.Parent.Protect myPW
> >> End If
> >> End Sub
>
> >> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> >> Set ECell = Range("C4")
> >> If Target.Address <> ECell.Address Then Exit Sub
> >> If MsgBox("Do you want toeditcell" & ECell.Address(False, False) & "?", vbYesNo) = vbNo Then Exit
> >> Sub
> >> On Error GoTo BadPW
> >> myPW = Application.InputBox("What is the password?")
> >> GoodPW = False
> >> Target.Parent.Unprotect myPW
> >> GoodPW = True
> >> ECell.Locked = False
> >> Target.Parent.Protect myPW
>
> >> Exit Sub
> >> BadPW:
> >> MsgBox "That password was incorrect...."
>
> >> End Sub
>
> >> "SNM" <snigdhahatesma...@gmail.com> wrote in message
>
> >>news:c3edff51-28af-4d34-af94-(E-Mail Removed)...
>
> >> >I need some help withprotectedcells. I have many cells with
> >> > formulas. All of them areprotected. However, sometimes I cannot
> >> > accept the value calculated by theformulaand in such cases, I need
> >> > to enter the value manually. To do this, I want toeditthecellby
> >> > using a password. Different users will be entering the value manually
> >> > so if possible I would like to have a recording system of the user
> >> > name. Also after the value is entered, thecellshould beprotected
> >> > again. Is this too ambitious? I would really appreciate a prompt
> >> > response on this matter. Thanking in advance.
Thanks so much! It works perfectly. I would like to to know about the
following enhancements. Please let me know how can go about these:
1) How can I set the Ecell range as an entire column. Also can I set
multiple columns as well. I mean can the same function be run on two
separate columns in the same sheet? If yes, please let me know the
change in code.
2) In the records sheet, I am currently recording the manually entered
value. Please advise how can I record the original value as well.
I greatly appreciate your advise on the above matters.
Regards,
SNM
|