after cell update

RhodEvans

Board Regular
Joined
Oct 31, 2012
Messages
88
Morning everyone,

I have a workbook that is going to be used by someone who has a (deserved) reputation for wrecking data. I am trying to restrict her access to the sheet, so she can enter but not ruin things.
I have set it up so that the restrictions only apply to her network log-on (using this function)

Code:
 Function isPermitted() As Boolean
If UBound(Filter(Application.Transpose(Sheets("MySecretSheet").Range("A1:A10").Value), Environ("username"))) = 0 Then isPermitted = True

 End Function

and then the protection after:

Code:
If Not isPermitted() Then


The bit I am having issues with is that I want if a cell has data is (I have text, dates, integers and functions) then if she types anything into the cell it will just replace it with the value it had previously. I have a code that works, but have no way to trigger it as there is no afterchange event, and I cannot figure out how to do it. The code I have is below:

Code:
Dim p As Variant


p = ActiveCell.Value

    If ActiveCell.Value = "" Then
        GoTo ender
    Else
     ' ActiveCell.Offset(0, 100).Select
       ActiveCell.Value = p
    End If
ender:

I would be grateful if anyone has any ideas on how I can get this to work, or anything else that would give me the same effect.

As always I am thankful for your help and support.

Rhod
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
How about in the sheet's code module

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,273
Members
448,883
Latest member
fyfe54

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top