Check Mark

pincivma

Board Regular
Joined
Dec 12, 2004
Messages
206
Hi There

I need your help again. I created an event procedure with macros that inserts a check mark in cells When the cells are clicked only once and I made the cell color turn green. The original colors of the cells are gray. When I double click on the cells, the check mark deletes and the cell color turns white. It is no longer grey. Is it possible to make the cell's original color stay?? Here are my 2 macros. I did not include the Event Procedure.

Sub AddsCheckMark() 'This macro adds the check marks
Sheets("Sheet1").Select
If ActiveSheet.ProtectContents Then
ActiveSheet.Unprotect Password:="1234"
End If
ActiveCell.Select
With Selection.Font
.Name = "Wingdings"
.FontStyle = "Regular"
.Size = 14
.ColorIndex = xlAutomatic
.Bold = True
End With

With Selection
.HorizontalAlignment = xlCenter
End With


ActiveCell.FormulaR1C1 = "ü"
ActiveCell.Interior.ColorIndex = 4
ActiveCell.Locked = False
ActiveCell.FormulaHidden = False
If Not ActiveSheet.ProtectContents Then
ActiveSheet.Protect Password:="1234"
End If
End Sub


Sub ClearsCheckmark() 'This macro deletes the check mark and the color green

Sheets("Sheet1").Select
If ActiveSheet.ProtectContents Then
ActiveSheet.Unprotect Password:="1234"
End If
Selection.Clear ' This code deletes the check mark and the color green but does not leave the original grey color. It turns the cell color white.
ActiveCell.Offset(0, 1).Select

If Not ActiveSheet.ProtectContents Then
ActiveSheet.Protect Password:="1234"
End If
End Sub
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this:

Code:
With Selection
.Clear ' This code deletes the check mark and the color green
.Style = "Custom Gray" 'sets the cell style using a custom style named Custom Gray
End With

Of course, you'll need to create the style and name it what you want.
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,731
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top