Need Excel VBA code that will allow me to protect certain cells and not others.

At the moment I have inserted VBA code into my spreadsheet to allow for clicks of the mouse to add or remove colour. When I try to insert code, in combination with my own code, to protect certain cells or use unlocked/locked functions it will not work.

I need somebody to write some code that will allow me to still protect certain cells and click to change colours on others.

I have pasted the code I used below;

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Cancel = True

Select Case [url removed, login to view]

Case xlNone, 4: [url removed, login to view] = 3

Case Else: [url removed, login to view] = 4

End Select

End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)

Cancel = True

[url removed, login to view] = xlNone

End Sub

Skills: Excel

See more: excel vba lock cells with formula, excel vba lock cells based on value, unable to set the locked property of the range class, vba prevent cell editing, excel vba lock cells in a range, vba lock cells after data entered, excel vba lock all cells, excel vba lock cells without protecting sheet, excel vba code pull internet data, ftp connection excel vba code, create domain class excel vba code, excel vba code data web page, excel vba code check add ins, optimize excel vba code, need vba code allow open application, optimizing excel vba code, inventory excel vba code, excel vba code open internet explorer, excel vba code update, excel vba code ftp

About the Employer:
( 3 reviews ) Toongabbie, Australia

Project ID: #16128060

Awarded to:


I have been using VBA for a long time now to solve different business processes which native functions of Excel can't do. Feel free to message me so that we can talk more about this project.

$30 AUD in 1 day
(5 Reviews)

9 freelancers are bidding on average $60 for this job


I am an Excel VBA specialist. All of my projects involve Excel and VBA so I am quite confident that I can assist you with this project. Feel free to contact me so we can discuss the details of this project.

$50 AUD in 1 day
(18 Reviews)
$155 AUD in 3 days
(12 Reviews)

Hi, I'm not really sure about what you want, but I think I have a solution for it. I'm waiting your reply. Thanks.

$35 AUD in 1 day
(30 Reviews)
$55 AUD in 3 days
(14 Reviews)

Hi, Glad to know your requirement. I am an excel vba expert and have delivered five vba projects in the past one month. Would like to do the task for you. I will do this task within 3 to 4 hours, and the deadline is 24 More

$66 AUD in 1 day
(7 Reviews)

Hello there, I would like to be considered for this job as I have great working experience in VBA development. Thanks, Ramesh

$88 AUD in 3 days
(3 Reviews)

I will give you the code once you run it, certain cells will be locked and you can't enter any data inside. If you need to protect the format as well, please let me know so I can see what I can do for you. The c More

$30 AUD in 0 days
(3 Reviews)

i have worked with plenty of vba applications, as well as vbs applications. I can deliver in 2-3 days.

$35 AUD in 10 days
(0 Reviews)