filmov
tv
Conditional format and lock cells with VBA
![preview_player](https://i.ytimg.com/vi/8salNcJT6_4/maxresdefault.jpg)
Показать описание
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.
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.
Комментарии