Change color of final result based on raw data given

  • Hi guys,

    I have this excel sheet (attached) where I have to put in data in the "raw data" sheet and it compares the X axis and Y axis of the data and gives me a nice result in my chosen worksheet (triggered by hitting the "run macro" button in worksheet "Jun17").

    I would like to change the color of the final result based on my raw data - if the raw data on this sheet has a red cell highlight, I would like the final result to also be marked in red.

    I can't seem to crack this one, would appreciate if someone could show me how, thanks!

  • Re: Change color of final result based on raw data given

    Can't download the sheet as I'm at work.

    But you should be able to use the ".Interior.Color" property of the range/cell to get the fill colour of the cell.

    Not sure what the shade of red is that you want to validate against but you can easily get this by following your code through to where it picks up the cell colour.

    Once you know the serial number for the colour you should easily be able to validate an If Statement against it.

    Something like:

    If lngOriginalFill = RedColourSerialCode then
         cell.Interior.Color = RedColourSerialCode
    end if
  • Re: Change color of final result based on raw data given

    Another option is of course using Styles rather than fill colours which incorporate a number of properties into a single command, where if you just change the fill colour your font colour may not show too well against the new background colour.

    If you want to use styles rather than background fill colour the property for the range is just ".style". The value is a string representation of the style name.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!