ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Stop Formula input (https://www.excelbanter.com/excel-discussion-misc-queries/167811-stop-formula-input.html)

Gruff

Stop Formula input
 
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

Mike H

Stop Formula input
 
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

"Gruff" wrote:

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



All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com