Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Would like to apply the code to protect cell
Good afternoon. If I would like to change some code of this VBA for m
sheet for e.g. sheet1, sheet2.... to protect my cell at the same ro and column. What should I do. This code I download from the Interne and I would like to apply for my job. But I do the another way by copy and paste to every sheet. It's OK. but my diskette is poor. The code is: Private Sub Worksheet_Activate() End Sub Private Sub Worksheet_Change(ByVal Target As Range) End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) prevent_formula End Sub Private Sub prevent_formula() ' 0 <r 65500 ' 0 <c 255 r1 = 9 r2 = 53 c1 = 25 '3 If r2 < r1 Or r1 = 0 Or r2 = 2 Or c1 = 0 Then GoTo ende If r2 65530 Or r1 65530 Or c1 255 Then GoTo ende Do Until r1 = r2 + 1 If ActiveCell.Row = r1 And ActiveCell.Column = c1 Then MsgBox ("This Cell can not Change") Range("A1").Select GoTo ende Else r1 = r1 + 1 End If Loop ende: Application.CutCopyMode = False End Sub Thank you very much -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Make code apply to more than 1 column | Excel Discussion (Misc queries) | |||
alter code to apply to range (links cells w/ row insertions) | Excel Discussion (Misc queries) | |||
Problem undstanding how to apply a code | Excel Discussion (Misc queries) | |||
How many conditions can I apply to a cell? I need to apply 8. | Excel Discussion (Misc queries) | |||
Protect Code | Excel Programming |