+ Reply to Thread
Results 1 to 4 of 4

Reformat changed cell

  1. #1
    Shawn
    Guest

    Reformat changed cell

    I need a VBA code that will cause the formatting of cells A1:A10 to change to
    bold, blue if the value of the cell changes.

    There are numerical values coded in cells A1:A10 at present. If the user
    goes into one of those cells and changes the value to a different value, (say
    in Cell A2), I need cell A2 to change its formatting automatically to bold,
    blue.

    I figure I need a change or change event code.




    --
    Thanks
    Shawn

  2. #2
    Tom Ogilvy
    Guest

    Re: Reformat changed cell

    With only 10 cells, it might be just as easy to use conditional formatting.

    if cell value is not equal to 3

    as a condition for example. Hard code the original numbers in the
    condition.

    --
    Regards,
    Tom Ogilvy

    "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    news:1A86FE48-C191-4D99-9AFE-D0F4F2500AA6@microsoft.com...
    > I need a VBA code that will cause the formatting of cells A1:A10 to change

    to
    > bold, blue if the value of the cell changes.
    >
    > There are numerical values coded in cells A1:A10 at present. If the user
    > goes into one of those cells and changes the value to a different value,

    (say
    > in Cell A2), I need cell A2 to change its formatting automatically to

    bold,
    > blue.
    >
    > I figure I need a change or change event code.
    >
    >
    >
    >
    > --
    > Thanks
    > Shawn




  3. #3
    Shawn
    Guest

    Re: Reformat changed cell

    I just used those ten cells as an example. It will apply to a much larger
    area and is a code I might use over and over in the future. Any help would
    be appreciated.


    --
    Thanks
    Shawn


    "Tom Ogilvy" wrote:

    > With only 10 cells, it might be just as easy to use conditional formatting.
    >
    > if cell value is not equal to 3
    >
    > as a condition for example. Hard code the original numbers in the
    > condition.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > news:1A86FE48-C191-4D99-9AFE-D0F4F2500AA6@microsoft.com...
    > > I need a VBA code that will cause the formatting of cells A1:A10 to change

    > to
    > > bold, blue if the value of the cell changes.
    > >
    > > There are numerical values coded in cells A1:A10 at present. If the user
    > > goes into one of those cells and changes the value to a different value,

    > (say
    > > in Cell A2), I need cell A2 to change its formatting automatically to

    > bold,
    > > blue.
    > >
    > > I figure I need a change or change event code.
    > >
    > >
    > >
    > >
    > > --
    > > Thanks
    > > Shawn

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Reformat changed cell

    That means you have to store the starting values of the cells someplace and
    make a comparison. Even if the user edits the cell, they don't necessarily
    change the value stored there.

    the pseudo code might be

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell as Range, rng as Range
    if Intersect(Target,Range("A1:a10")) is nothing then exit sub
    set rng = Intersect(Target,Range("A1:A10"))
    for each cell in rng
    if cell.Value <> functionthatfetchesOriginalValue(cell) then
    cell.Font.ColorIndex = 5
    cell.Font.Bold = True
    end if
    Next
    End Sub

    such code would be place in the sheet module for that sheet (right click on
    the sheet tab and select view code).

    How you want to store those values for reference would be specific to what
    you are doing. perhaps on a hidden sheet or in a defined name or something.

    for a general reference
    Chip Pearson's page on events
    http://www.cpearson.com/excel/events.htm

    --
    Regards,
    Tom Ogilvy


    "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    news:5A3D99B9-E158-43F0-A337-24270AD2A72B@microsoft.com...
    > I just used those ten cells as an example. It will apply to a much larger
    > area and is a code I might use over and over in the future. Any help

    would
    > be appreciated.
    >
    >
    > --
    > Thanks
    > Shawn
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > With only 10 cells, it might be just as easy to use conditional

    formatting.
    > >
    > > if cell value is not equal to 3
    > >
    > > as a condition for example. Hard code the original numbers in the
    > > condition.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Shawn" <Shawn@discussions.microsoft.com> wrote in message
    > > news:1A86FE48-C191-4D99-9AFE-D0F4F2500AA6@microsoft.com...
    > > > I need a VBA code that will cause the formatting of cells A1:A10 to

    change
    > > to
    > > > bold, blue if the value of the cell changes.
    > > >
    > > > There are numerical values coded in cells A1:A10 at present. If the

    user
    > > > goes into one of those cells and changes the value to a different

    value,
    > > (say
    > > > in Cell A2), I need cell A2 to change its formatting automatically to

    > > bold,
    > > > blue.
    > > >
    > > > I figure I need a change or change event code.
    > > >
    > > >
    > > >
    > > >
    > > > --
    > > > Thanks
    > > > Shawn

    > >
    > >
    > >




+ 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