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 |
All times are GMT +1. The time now is 05:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com