Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Right click sheet tab>view code>insert this Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub Select Case LCase(Target) Case Is = "one": x = 1 Case Is = "one": x = 1 Case Is = "two": x = 6 Case Is = "three": x = 3 Case Is = "four": x = 4 Case Else End Select Rows(Target.Row).Interior.ColorIndex = x End Sub Don Guillett SalesAid Software dguille...@gmail.com -Original Message- From: FJO Sent: Tuesday, November 15, 2011 7:49 AM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ Conditional formatting of entire row using VBA Hi Can anyone help me with the VBA code for conditional formatting in Excel. I have af worksheet of 1000 rows with 5 colums. I have data in colum B;E and would like Excel to format the rows in a colour depending of what I write in colum A. I have 5 different text imput I can chose for each row, lets call them "one" "two" "Three" "Four" "Five" ...just to keep this example as simple as possible. If I write "one" in A2, I would like Excel to color Row 2 in one color, if I write "Two" then another color and so on. I found out how to color the cell I changed, but I would like to have the whole row colored. I hope someone can send me an example. -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Here's how you do it. Select your entire row. Assuming your top left cell in the entire selection is A1 (will be any one cell in the first column depending on where you started your selection) Go to conditional format, and in the options 'Use formula to determine which cells to format', write =$A1="One" and then apply the required format you need. Check the attachment. Regards, Sam Mathai Chacko On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: > Hi > > Can anyone help me with the VBA code for conditional formatting in > Excel. > > I have af worksheet of 1000 rows with 5 colums. I have data in colum > B;E and would like Excel to format the rows in a colour depending of > what I write in colum A. > > I have 5 different text imput I can chose for each row, lets call > them > "one" > "two" > "Three" > "Four" > "Five" > > ...just to keep this example as simple as possible. > > If I write "one" in A2, I would like Excel to color Row 2 in one > color, if I write "Two" then another color and so on. > > I found out how to color the cell I changed, but I would like to have > the whole row colored. > > I hope someone can send me an example. > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -- > To post to this group, send email to excel-macros@googlegroups.com > -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com Conditional Format On Entire Row.xlsx Description: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Sam, > "one" > "two" Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 10:21 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA Here's how you do it. Select your entire row. Assuming your top left cell in the entire selection is A1 (will be any one cell in the first column depending on where you started your selection) Go to conditional format, and in the options 'Use formula to determine which cells to format', write =$A1="One" and then apply the required format you need. Check the attachment. Regards, Sam Mathai Chacko On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: Hi Can anyone help me with the VBA code for conditional formatting in Excel. I have af worksheet of 1000 rows with 5 colums. I have data in colum B;E and would like Excel to format the rows in a colour depending of what I write in colum A. I have 5 different text imput I can chose for each row, lets call them "one" "two" "Three" "Four" "Five" ...just to keep this example as simple as possible. If I write "one" in A2, I would like Excel to color Row 2 in one color, if I write "Two" then another color and so on. I found out how to color the cell I changed, but I would like to have the whole row colored. I hope someone can send me an example. -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Yes Don. I was just showing how it is done for one conditional. I had it done for One to Five in the attachment I had posted. Regards, Sam On Tue, Nov 15, 2011 at 10:07 PM, dguillett1 wrote: > Sam, > > "one" > > "two" > > Don Guillett > SalesAid Software > dguille...@gmail.com > > *From:* Sam Mathai Chacko > *Sent:* Tuesday, November 15, 2011 10:21 AM > *To:* excel-macros@googlegroups.com > *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row > using VBA > > Here's how you do it. Select your entire row. Assuming your top left cell > in the entire selection is A1 (will be any one cell in the first column > depending on where you started your selection) > > Go to conditional format, and in the options 'Use formula to determine > which cells to format', write =$A1="One" > > and then apply the required format you need. > > Check the attachment. > > Regards, > > Sam Mathai Chacko > > On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: > >> Hi >> >> Can anyone help me with the VBA code for conditional formatting in >> Excel. >> >> I have af worksheet of 1000 rows with 5 colums. I have data in colum >> B;E and would like Excel to format the rows in a colour depending of >> what I write in colum A. >> >> I have 5 different text imput I can chose for each row, lets call >> them >> "one" >> "two" >> "Three" >> "Four" >> "Five" >> >> ...just to keep this example as simple as possible. >> >> If I write "one" in A2, I would like Excel to color Row 2 in one >> color, if I write "Two" then another color and so on. >> >> I found out how to color the cell I changed, but I would like to have >> the whole row colored. >> >> I hope someone can send me an example. >> >> -- >> FORUM RULES (934+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. >> Forum owners and members are not responsible for any loss. >> >> >> -- >> To post to this group, send email to excel-macros@googlegroups.com >> > > > > -- > Sam Mathai Chacko > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -- > To post to this group, send email to excel-macros@googlegroups.com > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Sam, I’m sorry.I opened in xl2003duh Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 10:51 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA Yes Don. I was just showing how it is done for one conditional. I had it done for One to Five in the attachment I had posted. Regards, Sam On Tue, Nov 15, 2011 at 10:07 PM, dguillett1 wrote: Sam, > "one" > "two" Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 10:21 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA Here's how you do it. Select your entire row. Assuming your top left cell in the entire selection is A1 (will be any one cell in the first column depending on where you started your selection) Go to conditional format, and in the options 'Use formula to determine which cells to format', write =$A1="One" and then apply the required format you need. Check the attachment. Regards, Sam Mathai Chacko On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: Hi Can anyone help me with the VBA code for conditional formatting in Excel. I have af worksheet of 1000 rows with 5 colums. I have data in colum B;E and would like Excel to format the rows in a colour depending of what I write in colum A. I have 5 different text imput I can chose for each row, lets call them "one" "two" "Three" "Four" "Five" ...just to keep this example as simple as possible. If I write "one" in A2, I would like Excel to color Row 2 in one color, if I write "Two" then another color and so on. I found out how to color the cell I changed, but I would like to have the whole row colored. I hope someone can send me an example. -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor threa
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
FJO, if you are using Excel 2003 or less, then I am afraid the solution I posted will not be very useful, as it requires more than 3 conditionals, which only Excel 2007+ supports. So in that case, Don's VBA code should suit you fine. But if you are in Excel 2007 or 2010, you could use multiple conditionals for formatting (which is what I'd prefer, it also helps in reducing VBA) Regards, Sam On Tue, Nov 15, 2011 at 10:35 PM, dguillett1 wrote: > Sam, I’m sorry.I opened in xl2003duh > > Don Guillett > SalesAid Software > dguille...@gmail.com > > *From:* Sam Mathai Chacko > *Sent:* Tuesday, November 15, 2011 10:51 AM > *To:* excel-macros@googlegroups.com > *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row > using VBA > > Yes Don. I was just showing how it is done for one conditional. I had it > done for One to Five in the attachment I had posted. > > Regards, > > Sam > > On Tue, Nov 15, 2011 at 10:07 PM, dguillett1 wrote: > >> Sam, >> > "one" >> > "two" >> >> Don Guillett >> SalesAid Software >> dguille...@gmail.com >> >> *From:* Sam Mathai Chacko >> *Sent:* Tuesday, November 15, 2011 10:21 AM >> *To:* excel-macros@googlegroups.com >> *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row >> using VBA >> >> Here's how you do it. Select your entire row. Assuming your top left >> cell in the entire selection is A1 (will be any one cell in the first >> column depending on where you started your selection) >> >> Go to conditional format, and in the options 'Use formula to determine >> which cells to format', write =$A1="One" >> >> and then apply the required format you need. >> >> Check the attachment. >> >> Regards, >> >> Sam Mathai Chacko >> >> On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: >> >>> Hi >>> >>> Can anyone help me with the VBA code for conditional formatting in >>> Excel. >>> >>> I have af worksheet of 1000 rows with 5 colums. I have data in colum >>> B;E and would like Excel to format the rows in a colour depending of >>> what I write in colum A. >>> >>> I have 5 different text imput I can chose for each row, lets call >>> them >>> "one" >>> "two" >>> "Three" >>> "Four" >>> "Five" >>> >>> ...just to keep this example as simple as possible. >>> >>> If I write "one" in A2, I would like Excel to color Row 2 in one >>> color, if I write "Two" then another color and so on. >>> >>> I found out how to color the cell I changed, but I would like to have >>> the whole row colored. >>> >>> I hope someone can send me an example. >>> >>> -- >>> FORUM RULES (934+ members already BANNED for violation) >>> >>> 1) Use concise, accurate thread titles. Poor thread titles, like Please >>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >>> will not get quick attention or may not be answered. >>> >>> 2) Don't post a question in the thread of another member. >>> >>> 3) Don't post questions regarding breaking or bypassing any security >>> measure. >>> >>> 4) Acknowledge the responses you receive, good or bad. >>> >>> 5) Cross-promotion of, or links to, forums competitive to this forum in >>> signatures are prohibited. >>> >>> NOTE : Don't ever post personal or confidential data in a workbook. >>> Forum owners and members are not responsible for any loss. >>> >>> >>> -- >>> To post to this group, send email to excel-macros@googlegroups.com >>> >> >> >> >> -- >> Sam Mathai Chacko >> -- >> FORUM RULES (934+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >>
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Hi Don Guillett Thanks for your answer. It works perfect in the example. I then hoped I could change a few things and the it would still work, but I can not, and I can not see why. Instead of writing "One", "Two" and so on in Colum A, I would like to change this for different status, examples could be "Not started", Awating info", "Finished" I have tried to put these different status texts into the code, but then it does not work. I am new to VBA, so I am sorry if this is obvious to others. Br. Finn On 15 Nov., 17:21, "dguillett1" wrote: > Right click sheet tab>view code>insert this > > Private Sub Worksheet_Change(ByVal Target As Range) > If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub > Select Case LCase(Target) > Case Is = "one": x = 1 > Case Is = "one": x = 1 > Case Is = "two": x = 6 > Case Is = "three": x = 3 > Case Is = "four": x = 4 > Case Else > End Select > Rows(Target.Row).Interior.ColorIndex = x > End Sub > > Don Guillett > SalesAid Software > dguille...@gmail.com > > > > -Original Message- > From: FJO > Sent: Tuesday, November 15, 2011 7:49 AM > To: MS EXCEL AND VBA MACROS > Subject: $$Excel-Macros$$ Conditional formatting of entire row using VBA > > Hi > > Can anyone help me with the VBA code for conditional formatting in > Excel. > > I have af worksheet of 1000 rows with 5 colums. I have data in colum > B;E and would like Excel to format the rows in a colour depending of > what I write in colum A. > > I have 5 different text imput I can chose for each row, lets call > them > "one" > "two" > "Three" > "Four" > "Five" > > ...just to keep this example as simple as possible. > > If I write "one" in A2, I would like Excel to color Row 2 in one > color, if I write "Two" then another color and so on. > > I found out how to color the cell I changed, but I would like to have > the whole row colored. > > I hope someone can send me an example. > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will > not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > ------ > To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Don's code should be pasted in the sheet code module of the corresponding sheet that you are working on. Please check. By the way, you wouldn't need VBA for the desired feature if you are using Excel 2007 or greater. Sam On Wed, Nov 16, 2011 at 12:03 AM, FJO wrote: > Hi Don Guillett > > Thanks for your answer. It works perfect in the example. I then hoped > I could change a few things and the it would still work, but I can > not, and I can not see why. > > Instead of writing "One", "Two" and so on in Colum A, I would like to > change this for different status, examples could be "Not started", > Awating info", "Finished" > > I have tried to put these different status texts into the code, but > then it does not work. I am new to VBA, so I am sorry if this is > obvious to others. > > Br. Finn > > On 15 Nov., 17:21, "dguillett1" wrote: > > Right click sheet tab>view code>insert this > > > > Private Sub Worksheet_Change(ByVal Target As Range) > > If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub > > Select Case LCase(Target) > > Case Is = "one": x = 1 > > Case Is = "one": x = 1 > > Case Is = "two": x = 6 > > Case Is = "three": x = 3 > > Case Is = "four": x = 4 > > Case Else > > End Select > > Rows(Target.Row).Interior.ColorIndex = x > > End Sub > > > > Don Guillett > > SalesAid Software > > dguille...@gmail.com > > > > > > > > -Original Message- > > From: FJO > > Sent: Tuesday, November 15, 2011 7:49 AM > > To: MS EXCEL AND VBA MACROS > > Subject: $$Excel-Macros$$ Conditional formatting of entire row using VBA > > > > Hi > > > > Can anyone help me with the VBA code for conditional formatting in > > Excel. > > > > I have af worksheet of 1000 rows with 5 colums. I have data in colum > > B;E and would like Excel to format the rows in a colour depending of > > what I write in colum A. > > > > I have 5 different text imput I can chose for each row, lets call > > them > > "one" > > "two" > > "Three" > > "Four" > > "Five" > > > > ...just to keep this example as simple as possible. > > > > If I write "one" in A2, I would like Excel to color Row 2 in one > > color, if I write "Two" then another color and so on. > > > > I found out how to color the cell I changed, but I would like to have > > the whole row colored. > > > > I hope someone can send me an example. > > > > -- > > FORUM RULES (934+ members already BANNED for violation) > > > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will > > not get quick attention or may not be answered. > > > > 2) Don't post a question in the thread of another member. > > > > 3) Don't post questions regarding breaking or bypassing any security > > measure. > > > > 4) Acknowledge the responses you receive, good or bad. > > > > 5) Cross-promotion of, or links to, forums competitive to this forum in > > signatures are prohibited. > > > > NOTE : Don't ever post personal or confidential data in a workbook. > Forum > > owners and members are not responsible for any loss. > > > > > ------ > > To post to this group, send email to excel-macros@googlegroups.com > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -- > To post to this group, send email to excel-macros@googlegroups.com > -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Hi Sam I am aware of the possibilities in office 2007 and later. But this sheet will be used by multiple users, someone still in office 2003. Therefore I will save it in the old office format. I knew where to put Don's code, and that worked, but I then wanted to change the words the conditional formatting depended on, but I was not able to do that in VBA. Thanks for your suggestions. I have tested those in office 2010 and they work great. I would have chosen that solution if I knew that none of the users were in office 2003. Br Finn On 15 Nov., 19:48, Sam Mathai Chacko wrote: > Don's code should be pasted in the sheet code module of the corresponding > sheet that you are working on. Please check. By the way, you wouldn't need > VBA for the desired feature if you are using Excel 2007 or greater. > > Sam > > > > > > On Wed, Nov 16, 2011 at 12:03 AM, FJO wrote: > > Hi Don Guillett > > > Thanks for your answer. It works perfect in the example. I then hoped > > I could change a few things and the it would still work, but I can > > not, and I can not see why. > > > Instead of writing "One", "Two" and so on in Colum A, I would like to > > change this for different status, examples could be "Not started", > > Awating info", "Finished" > > > I have tried to put these different status texts into the code, but > > then it does not work. I am new to VBA, so I am sorry if this is > > obvious to others. > > > Br. Finn > > > On 15 Nov., 17:21, "dguillett1" wrote: > > > Right click sheet tab>view code>insert this > > > > Private Sub Worksheet_Change(ByVal Target As Range) > > > If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub > > > Select Case LCase(Target) > > > Case Is = "one": x = 1 > > > Case Is = "one": x = 1 > > > Case Is = "two": x = 6 > > > Case Is = "three": x = 3 > > > Case Is = "four": x = 4 > > > Case Else > > > End Select > > > Rows(Target.Row).Interior.ColorIndex = x > > > End Sub > > > > Don Guillett > > > SalesAid Software > > > dguille...@gmail.com > > > > -Original Message- > > > From: FJO > > > Sent: Tuesday, November 15, 2011 7:49 AM > > > To: MS EXCEL AND VBA MACROS > > > Subject: $$Excel-Macros$$ Conditional formatting of entire row using VBA > > > > Hi > > > > Can anyone help me with the VBA code for conditional formatting in > > > Excel. > > > > I have af worksheet of 1000 rows with 5 colums. I have data in colum > > > B;E and would like Excel to format the rows in a colour depending of > > > what I write in colum A. > > > > I have 5 different text imput I can chose for each row, lets call > > > them > > > "one" > > > "two" > > > "Three" > > > "Four" > > > "Five" > > > > ...just to keep this example as simple as possible. > > > > If I write "one" in A2, I would like Excel to color Row 2 in one > > > color, if I write "Two" then another color and so on. > > > > I found out how to color the cell I changed, but I would like to have > > > the whole row colored. > > > > I hope someone can send me an example. > > > > -- > > > FORUM RULES (934+ members already BANNED for violation) > > > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > > > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > > will > > > not get quick attention or may not be answered. > > > > 2) Don't post a question in the thread of another member. > > > > 3) Don't post questions regarding breaking or bypassing any security > > > measure. > > > > 4) Acknowledge the responses you receive, good or bad. > > > > 5) Cross-promotion of, or links to, forums competitive to this forum in > > > signatures are prohibited. > > > > NOTE : Don't ever post personal or confidential data in a workbook. > > Forum > > > owners and members are not responsible for any loss. > > > ------ > > > To post to this group, send email to excel-macros@googlegroups.com > > > -- > > FORUM RULES (934+ members already BANNED for violation) > > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > > will not get quick attention or may not be answered. > > > 2) Don't post a question in the thread of another member. > > > 3) Don't post questions regarding breaking or bypassing any security > > measure. > > > 4) Acknowledge the responses you receive, good or bad. > > > 5) Cross-promotion of, or links to, forums competitive to this forum in > > signatures are prohibited. > > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > > owners and members are not responsible for any loss. > > > ------ > > To post to this group, send email to excel-macros@googlegroups.com > > -- > Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. P
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Sam, I am one of those that does NOT like a lot of CF or even a lot of data validation. So, why not take a lot of the work away from the user and not clutter up the file with cf and dv. Let me know what you think of this idea to just double click col A>select number to fill in Text and color row. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub Dim mn As Double Dim x As String Dim y As Long Dim msg As String msg = "Enter 1 for One" msg = msg & vbLf & "Enter 2 for Two" msg = msg & vbLf & "Enter 3 for Three" msg = msg & vbLf & "Enter 4 for Four" msg = msg & vbLf & "Enter 5 for Five" mn = Application.InputBox(Prompt:=msg, Title:="Enter a Number", Type:=1) If mn < 1 Or mn > 5 Then MsgBox "Invalid entry", vbExclamation Exit Sub End If Select Case mn Case 1: x = "One": y = 12 Case 2: x = "Two": y = 22 Case 3: x = "Three": y = 6 Case 4: x = "Four": y = 5 Case 5: x = "Five": y = 4 Case Else End Select Target = x Rows(Target.Row).Interior.ColorIndex = y End Sub Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 11:38 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA FJO, if you are using Excel 2003 or less, then I am afraid the solution I posted will not be very useful, as it requires more than 3 conditionals, which only Excel 2007+ supports. So in that case, Don's VBA code should suit you fine. But if you are in Excel 2007 or 2010, you could use multiple conditionals for formatting (which is what I'd prefer, it also helps in reducing VBA) Regards, Sam On Tue, Nov 15, 2011 at 10:35 PM, dguillett1 wrote: Sam, I’m sorry.I opened in xl2003duh Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 10:51 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA Yes Don. I was just showing how it is done for one conditional. I had it done for One to Five in the attachment I had posted. Regards, Sam On Tue, Nov 15, 2011 at 10:07 PM, dguillett1 wrote: Sam, > "one" > "two" Don Guillett SalesAid Software dguille...@gmail.com From: Sam Mathai Chacko Sent: Tuesday, November 15, 2011 10:21 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA Here's how you do it. Select your entire row. Assuming your top left cell in the entire selection is A1 (will be any one cell in the first column depending on where you started your selection) Go to conditional format, and in the options 'Use formula to determine which cells to format', write =$A1="One" and then apply the required format you need. Check the attachment. Regards, Sam Mathai Chacko On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: Hi Can anyone help me with the VBA code for conditional formatting in Excel. I have af worksheet of 1000 rows with 5 colums. I have data in colum B;E and would like Excel to format the rows in a colour depending of what I write in colum A. I have 5 different text imput I can chose for each row, lets call them "one" "two" "Three" "Four" "Five" ...just to keep this example as simple as possible. If I write "one" in A2, I would like Excel to color Row 2 in one color, if I write "Two" then another color and so on. I found out how to color the cell I changed, but I would like to have the whole row colored. I hope someone can send me an example. -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. --
Re: $$Excel-Macros$$ Conditional formatting of entire row using VBA
Totally buy that Don. Cheers, Sam On Wed, Nov 16, 2011 at 12:50 AM, dguillett1 wrote: > Sam, I am one of those that does NOT like a lot of CF or even a lot of > data validation. So, why not take a lot of the work away from the user and > not clutter up the file with cf and dv. Let me know what you think of this > idea to just double click col A>select number to fill in Text and color row. > > Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As > Boolean) > If Target.Count > 1 Or Target.Column <> 1 Then Exit Sub > Dim mn As Double > Dim x As String > Dim y As Long > > Dim msg As String > msg = "Enter 1 for One" > msg = msg & vbLf & "Enter 2 for Two" > msg = msg & vbLf & "Enter 3 for Three" > msg = msg & vbLf & "Enter 4 for Four" > msg = msg & vbLf & "Enter 5 for Five" > > mn = Application.InputBox(Prompt:=msg, Title:="Enter a Number", > Type:=1) > If mn < 1 Or mn > 5 Then >MsgBox "Invalid entry", vbExclamation >Exit Sub > End If > > Select Case mn > Case 1: x = "One": y = 12 > Case 2: x = "Two": y = 22 > Case 3: x = "Three": y = 6 > Case 4: x = "Four": y = 5 > Case 5: x = "Five": y = 4 > Case Else > End Select > > Target = x > Rows(Target.Row).Interior.ColorIndex = y > End Sub > > Don Guillett > SalesAid Software > dguille...@gmail.com > > *From:* Sam Mathai Chacko > *Sent:* Tuesday, November 15, 2011 11:38 AM > *To:* excel-macros@googlegroups.com > *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row > using VBA > > FJO, if you are using Excel 2003 or less, then I am afraid the solution I > posted will not be very useful, as it requires more than 3 conditionals, > which only Excel 2007+ supports. > > So in that case, Don's VBA code should suit you fine. But if you are in > Excel 2007 or 2010, you could use multiple conditionals for formatting > (which is what I'd prefer, it also helps in reducing VBA) > > Regards, > Sam > > On Tue, Nov 15, 2011 at 10:35 PM, dguillett1 wrote: > >> Sam, I’m sorry.I opened in xl2003duh >> >> Don Guillett >> SalesAid Software >> dguille...@gmail.com >> >> *From:* Sam Mathai Chacko >> *Sent:* Tuesday, November 15, 2011 10:51 AM >> *To:* excel-macros@googlegroups.com >> *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row >> using VBA >> >> Yes Don. I was just showing how it is done for one conditional. I had >> it done for One to Five in the attachment I had posted. >> >> Regards, >> >> Sam >> >> On Tue, Nov 15, 2011 at 10:07 PM, dguillett1 wrote: >> >>> Sam, >>> > "one" >>> > "two" >>> >>> Don Guillett >>> SalesAid Software >>> dguille...@gmail.com >>> >>> *From:* Sam Mathai Chacko >>> *Sent:* Tuesday, November 15, 2011 10:21 AM >>> *To:* excel-macros@googlegroups.com >>> *Subject:* Re: $$Excel-Macros$$ Conditional formatting of entire row >>> using VBA >>> >>> Here's how you do it. Select your entire row. Assuming your top left >>> cell in the entire selection is A1 (will be any one cell in the first >>> column depending on where you started your selection) >>> >>> Go to conditional format, and in the options 'Use formula to determine >>> which cells to format', write =$A1="One" >>> >>> and then apply the required format you need. >>> >>> Check the attachment. >>> >>> Regards, >>> >>> Sam Mathai Chacko >>> >>> On Tue, Nov 15, 2011 at 7:19 PM, FJO wrote: >>> >>>> Hi >>>> >>>> Can anyone help me with the VBA code for conditional formatting in >>>> Excel. >>>> >>>> I have af worksheet of 1000 rows with 5 colums. I have data in colum >>>> B;E and would like Excel to format the rows in a colour depending of >>>> what I write in colum A. >>>> >>>> I have 5 different text imput I can chose for each row, lets call >>>> them >>>> "one" >>>> "two" >>>> "Three" >>>> "Four" >>>> "Five" >>>> >>>> ...just to keep this example