Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make code apply to more than 1 column Cheryl Excel Discussion (Misc queries) 6 April 16th 10 10:02 PM
alter code to apply to range (links cells w/ row insertions) purplec0ws Excel Discussion (Misc queries) 1 November 10th 09 10:19 AM
Problem undstanding how to apply a code Brenda Excel Discussion (Misc queries) 4 October 21st 08 07:55 PM
How many conditions can I apply to a cell? I need to apply 8. Markus Excel Discussion (Misc queries) 2 July 10th 08 01:06 PM
Protect Code JC[_7_] Excel Programming 4 November 25th 03 03:52 PM


All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"