+ Reply to Thread
Results 1 to 2 of 2

Background color change

  1. #1
    Leif
    Guest

    Background color change

    I have a VBA routine, run from Access, that writes out data to an spreadsheet
    (using Automation). In my spreadsheet I've added a routine to change the
    background color of any cell that is changed. The problem is, my Access
    program, in populating the spreadsheet, is causing the background to change
    as it writes values to the spreadsheet. I only want the background to change
    by a user, after the spreadsheet is populated

    Is there a way to do that? If I can programmatically add the event
    procedure to the spreadsheet after is is populated that would problaby do it.
    However, i don't know how to do that, or if it can be done. Thanks for your
    help.

    Regards,
    Leif

  2. #2
    Tom Ogilvy
    Guest

    RE: Background color change

    the first choice is
    xlApp.EnableEvents = False

    but it is recognized that in some verions of Excel, this doesn't work. So
    next,

    Why not simply

    Cells.Interior.ColorIndex = -4142 ' xlNone

    after you are done updating.

    or restrict this code to the range where you were working.

    an alternative would be a cell that is normally blank but you place a value
    in it when you are ready to write.

    You change routine would be altered to not color this cell and not color any
    cell if this cell contains a value. then clear this cell at the end.

    Adding the event procedure would be a distant choice for me.
    http://www.cpearson.com/excel/vbe.htm


    --
    Regards,
    Tom Ogilvy



    "Leif" wrote:

    > I have a VBA routine, run from Access, that writes out data to an spreadsheet
    > (using Automation). In my spreadsheet I've added a routine to change the
    > background color of any cell that is changed. The problem is, my Access
    > program, in populating the spreadsheet, is causing the background to change
    > as it writes values to the spreadsheet. I only want the background to change
    > by a user, after the spreadsheet is populated
    >
    > Is there a way to do that? If I can programmatically add the event
    > procedure to the spreadsheet after is is populated that would problaby do it.
    > However, i don't know how to do that, or if it can be done. Thanks for your
    > help.
    >
    > Regards,
    > Leif


+ 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