ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   on click change cells color and increase a number.. (https://www.excelbanter.com/excel-programming/343070-click-change-cells-color-increase-number.html)

Daniel

on click change cells color and increase a number..
 
hi..

i already know how to change the cell's colors when i click it.. but i need
to increase a number on one specific cell when the color of any cell is red..

can someone help me pls?



Chip Pearson

on click change cells color and increase a number..
 
Daniel,

Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then
Exit Sub
End If

Application.EnableEvents = False
On Error GoTo ErrH
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing
Then
Target.Interior.ColorIndex = 3
Target.Value = Target.Value + 1
End If

ErrH:
Application.EnableEvents = True
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Daniel" wrote in message
...
hi..

i already know how to change the cell's colors when i click
it.. but i need
to increase a number on one specific cell when the color of any
cell is red..

can someone help me pls?





Daniel

on click change cells color and increase a number..
 
nop.. it isnt working :(

but thanks for the help..

Daniel.

"Chip Pearson" wrote:

Daniel,

Try something like the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then
Exit Sub
End If

Application.EnableEvents = False
On Error GoTo ErrH
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing
Then
Target.Interior.ColorIndex = 3
Target.Value = Target.Value + 1
End If

ErrH:
Application.EnableEvents = True
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Daniel" wrote in message
...
hi..

i already know how to change the cell's colors when i click
it.. but i need
to increase a number on one specific cell when the color of any
cell is red..

can someone help me pls?







All times are GMT +1. The time now is 07:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com