Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok VBA prgs....
I need this solution: A person left clicks on a cell that already has text in it. I need that cell to (1) change color, and (2) generate a value (in a different cell) because the person clicked in the text cell (can be value of 1 or 0). For example, in Column A, in cells 1-12 I write in the months of the year. If a person clicks on the cell containing "March" (cell A3) I want that cell to change to the color yellow, and in cell B3 the number "1" is entered. Any ideas? --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason,
Add this code to the worksheet code module Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("A1:A12")) Is Nothing Then Range("A1:A12").Interior.ColorIndex = xlColorIndexNone Target.Interior.ColorIndex = 6 Target.Offset(0, 1) = 1 End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "jasonsweeney " wrote in message ... Ok VBA prgs.... I need this solution: A person left clicks on a cell that already has text in it. I need that cell to (1) change color, and (2) generate a value (in a different cell) because the person clicked in the text cell (can be value of 1 or 0). For example, in Column A, in cells 1-12 I write in the months of the year. If a person clicks on the cell containing "March" (cell A3) I want that cell to change to the color yellow, and in cell B3 the number "1" is entered. Any ideas? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much that is helpful.
But I need the color to remain "on" once clicked, but if you click th same cell again, then the color turns "off" (and the number als dissapears). Thus, in my example, if you select March, the cell turns yellow an Cell B3 gets a "1." Then you select "January". Now there should b two yellow cells, both with a "1" next to it. Now I click on "March again and it turns back to no color, leaving only January yellow with "1" next to it -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason,
Okay try this Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("A1:A12")) Is Nothing Then If Target.Offset(0,1) = 1 Then Target.Interior.Colorindex = xlColorindexNone Target.Offset(0,1).Value = "" Else Target.Interior.ColorIndex = 6 Target.Offset(0, 1) = 1 End If End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "jasonsweeney " wrote in message ... Thank you very much that is helpful. But I need the color to remain "on" once clicked, but if you click the same cell again, then the color turns "off" (and the number also dissapears). Thus, in my example, if you select March, the cell turns yellow and Cell B3 gets a "1." Then you select "January". Now there should be two yellow cells, both with a "1" next to it. Now I click on "March" again and it turns back to no color, leaving only January yellow with a "1" next to it. --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One problem:
I incorporated your code into the application I am working on....but now I get an "Error 13" when I try and select more than one cell..... still using my example, When I select March AND February at the same time in one selection, I get an error 13. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Theme color doesn't change when I click it? | Excel Worksheet Functions | |||
can u make a text in a cell to blink , or change it's color? | Excel Worksheet Functions | |||
make cell color change if requirements are met? | Excel Discussion (Misc queries) | |||
Stumped: If a cell contains a formula, can you make text color automatically change? | Excel Worksheet Functions | |||
Change cell back color on click | Excel Discussion (Misc queries) |