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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,598
Messages
5,832,645
Members
430,150
Latest member
amitk1

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
Top