macronoob7 Posted April 5, 2010 Report Share Posted April 5, 2010 So here is my dilemma, I am trying to find out if I can have Macro Express differentiate from different colored text. I have a macro that I am building that will become much easier if the macro is smart enough to recognize the color of text in an excel spreadsheet. Essentially if it can recognize the color of text I want it to run a certain macro, if it sees another text color it would not run it. I think this is kind of a shot in the dark, but if it works this will save me a ton of time. Quote Link to comment Share on other sites More sharing options...
terrypin Posted April 5, 2010 Report Share Posted April 5, 2010 So here is my dilemma, I am trying to find out if I can have Macro Express differentiate from different colored text. I have a macro that I am building that will become much easier if the macro is smart enough to recognize the color of text in an excel spreadsheet. Essentially if it can recognize the color of text I want it to run a certain macro, if it sees another text color it would not run it. I think this is kind of a shot in the dark, but if it works this will save me a ton of time. Use the Get Pixel Color command, after reading the Help about it. Follow that with IF Variable tests. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Yehnfikm8Gq Posted April 5, 2010 Report Share Posted April 5, 2010 (edited) I was curious to see how one could find the text so I ran a quick test. You need to find a cell you know will have text and select it (Text Type Ctrl+G followed by cell ref/Enter). If you move the mouse to the text cursor, it will be the top left corner of the cell. You can adjust mouse position vertically to the centreline of the cell and then run across the cell a few pixels at a time with a Repeat loop until you find a colour not equal to background or gridline. You could also format the cell (Text Type Ctrl+1), go to Font tab (Text Type F), move mouse to colour bar which will always be in the same place relative to Format Cells window and get the colour (or get colour at specific coords). Then Text Type Esc to Cancel. I have an old rev of Excel so there could be differences. Edited April 6, 2010 by JohnS Quote Link to comment Share on other sites More sharing options...
macronoob7 Posted April 6, 2010 Author Report Share Posted April 6, 2010 Thanks for your suggestions, I will have to try them out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.