Help a newbie!

southernsquid

Board Regular
Joined
May 19, 2011
Messages
60
I want to be able to double click in a cell and it places a X in the cell. I want to also have that X have a value=1. Better yet I would like to be able to double click and get a color and have the color have a value.

I have a macro for the double click for color but how do I add in a value? Is it even possible?

Here is the macro I have and I should mention, this is the 1st macro I've ever delt with. Please explain exactly how to add any new macros you can provide. Thanks

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
 
   If Target.Interior.ColorIndex = xlNone Then
 
     Target.Interior.ColorIndex = 4
 
   ElseIf Target.Interior.ColorIndex = 4 Then
 
     Target.Interior.ColorIndex = xlNone
 
   End If
 
   Cancel = True
 
End Sub
 
Last edited by a moderator:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
You are not making sense. Can you explain what you mean by:

"it places a X in the cell. I want to also have that X have a value=1"

and

"get a color and have the color have a value"
?

Do you mean that you'd like to count how many X's there are afterwards? ( use the COUNTIF function ).

Or that you'd like to count by colour? Don't try and go this route ... fill with X or 1, and if you want the cells coloured use Conditional Formatting to colour them depending on their contents.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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