Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2012, 06:07 PM
ubns ubns is offline Re: excel macro for changing the row color Windows 7 32bit Re: excel macro for changing the row color Office 2010 32bit
Competent Performer
Re: excel macro for changing the row color
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Re: excel macro for changing the row color

is it possible to write a macro or get the code to change the color of row depending on the cell value (in text, not numeric value).



To explain further - there are four options in the list box (or drop down). One option is - Started. When we select startred it should change the row color to yellow. when we select another option --- completed, then the row color should change to green.
Reply With Quote
  #2  
Old 04-11-2012, 10:12 PM
Catalin.B Catalin.B is offline Re: excel macro for changing the row color Windows Vista Re: excel macro for changing the row color Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

You do not need a macro to do that, simply use conditional formatting.
Select the entire range of cells that you want to apply this format, then go to home tab-->conditional formatting-->New Rule-->Use a formula to determine which cells to format, then in formula field enter this( assuming that your range starts from A8, and in column A is your data validation list):
=$A8="Started" , and click on format button next to preview to pick a colour to fill the cells.
Create a second rule for the other colour, determine the cells to apply the rule with the formula :
=$A8="Completed"
And so on for other conditions...
Reply With Quote
  #3  
Old 04-11-2012, 11:39 PM
ubns ubns is offline Re: excel macro for changing the row color Windows 7 32bit Re: excel macro for changing the row color Office 2010 32bit
Competent Performer
Re: excel macro for changing the row color
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Thanks, I have tried it. It works once but then it changes that particular cell only.

I have ensured that relevant cells in the rows are selected.
Reply With Quote
  #4  
Old 04-11-2012, 11:48 PM
Catalin.B Catalin.B is offline Re: excel macro for changing the row color Windows Vista Re: excel macro for changing the row color Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Here is a sample attached, work fine.
Attached Files
File Type: xls example.xls (23.0 KB, 16 views)
Reply With Quote
  #5  
Old 04-12-2012, 09:12 PM
ubns ubns is offline Re: excel macro for changing the row color Windows 7 32bit Re: excel macro for changing the row color Office 2010 32bit
Competent Performer
Re: excel macro for changing the row color
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default thanks but still no good my sheet

Hi Catalin,

Thanks, i have tried on your sheet and works perfectly, but no on the existing excel sheet i have. may be becasue it has macros and lot of list boxes. Any suggestions?

Quote:
Originally Posted by Catalin.B View Post
Here is a sample attached, work fine.
Reply With Quote
  #6  
Old 04-12-2012, 09:17 PM
Catalin.B Catalin.B is offline Re: excel macro for changing the row color Windows Vista Re: excel macro for changing the row color Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Without seeing a sample of your workbook, i can't give you an answer, sorry...
Reply With Quote
  #7  
Old 04-12-2012, 09:20 PM
ubns ubns is offline Re: excel macro for changing the row color Windows 7 32bit Re: excel macro for changing the row color Office 2010 32bit
Competent Performer
Re: excel macro for changing the row color
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

i cannot see the option to start a new thread? do you know whY?
Reply With Quote
  #8  
Old 04-12-2012, 09:24 PM
Catalin.B Catalin.B is offline Re: excel macro for changing the row color Windows Vista Re: excel macro for changing the row color Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

You cannot start a new thread from your thread, only from https://www.msofficeforums.com/excel/
(for excel questions)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word macro doesn't change font color Spideriffic Word VBA 8 11-04-2015 03:47 AM
Changing bar color automatically Mahmuz PowerPoint 0 03-28-2012 11:49 PM
Re: excel macro for changing the row color Changing the Color on Banded Rows ParreDL PowerPoint 2 03-20-2012 12:31 PM
Select Series Color - Macro judicial85 Excel Programming 0 03-14-2011 02:35 PM
Changing mulitple images sizes with a macro or other FraserKitchell Drawing and Graphics 1 01-05-2010 11:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft