+ Reply to Thread
Results 1 to 3 of 3

on click change cells color and increase a number..

  1. #1
    Daniel
    Guest

    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?



  2. #2
    Chip Pearson
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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?
    >
    >




  3. #3
    Daniel
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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?
    > >
    > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1