Conditional format and lock cells with VBA

preview_player
Показать описание
Change the colour and lock cells of a certain value. How to determine the interior colour of a cell. Lock cells over a certain colour. Colour cells over a certain value. Conditional format and lock cells with VBA
Code
Sub showcolour()
MsgBox cellcolour
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Double
Dim rng As Range
Dim colorIndex As Integer

colorIndex = 3
x = 2

With Sheets("sheet1")
.Unprotect "test"
.Cells.Locked = False
End With

For x = 2 To 200

Dim color As Long

If Cells(x, 1).Value is greater than 5 Then
Cells(x, 1).Select
Selection.Locked = True
End If
Next x
Sheets("Sheet1").Protect "test"
End Sub


Contact me regarding customizing this template for your needs.

Excel one-on-one on-line training available. Email me to arrange.

I am able to provide online help on your computer at a reasonable rate.

Check out my next one-hour Excel Webinar

I use a Blue condensor Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

I use Tube Buddy to help promote my videos
Check them out

Follow me on Facebook


Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with.
Рекомендации по теме
Комментарии
Автор

Thank so much for watching my video. Please note, I am not allowed to include square brackets the description of the video, so that if you copy the code from the description, I have replaced >, <>, and < symbols with text.
Before using the code check for these instances.

BarbHendersonconsulting
Автор

Great
How can I apply this to value selected from a Drop-down?

omtschand
Автор

I am from india. Your videos are awesome.

VickyVigneshwaran
Автор

Awesome work. Here's my issue, If B1 = "NA", A1 must return 0 and be locked, if B1 is blank (no entry), A1 must allow data input. Please help

tshepomoleko