Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Launching macros automatically

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have written a macro to change the color of individual cells in a matrix based on the cell value. In this case, the cell values are vendor names, and I'd like the cell background to automatically change based on the formula results which indicate the best vendor.

    I tried the conditional formatting thing, but it only supports 3 conditions, and I have many more potential vendors (cell values) than that.

    I'd like the matrix colors to change when the user makes a chage/entry to the spreadsheet. In the past I've put a button on the worksheet for the user to click in order to update the formatting, but I'd like something more elegant if possible.

    Any thoughts?

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Put it in the Worksheet_Change() event and determine if any of the dependant cells (The ones that determine if a new color is needed) has changed (Using Intersect and Target), or, use the Worksheet_Calculate() event. This option I DO NOT recommend, i think it would make the workbook terribly slow !
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I opted for the Worksheet_Calculate() option on the worksheet in question since the vendor names I mentioned are selected by formulas. My research indicated that the Worksheet_Change() event wouldn't fire if the cell contents changed as a result of forumala output. The Worksheet_Calculation() solution works, but as you suspected has slowed the workbook down a little, but not too much.

    Many thanks for your help.


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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