Stop Formula input

G

Gruff

Hello,
I was wondering if anyone could help me. I'm trying to restrict formulas
being inputted into cells so that figures are inputted manually. This is
because the numbers can change due to links being broken or cells being moved
around on a worksheet. Can anybody help?

Thanks,
B
 
M

Mike H

Hi,

You could do this. Right click the sheet tab, view code and paste this in:-

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:b20" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
If Target.HasFormula Then
Target.Value = ""
MsgBox "Formula not allowed"
End If
End If
ws_exit:
Application.EnableEvents = True
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top