Electron_Sam78
New Member
Hello, I'm trying to get some code for a specific tasks. I'm less than a noob at Excel VBA and I'm currently working on a maintenance task sheet for a couple of generators and need help. I have successfully created button macros to input dates but now I think I'm in over my head. I would like a macro to copy all the cells that are RED (due to a condition rule) plus their associated fields to the left from worksheet "Schedule" to worksheet "Tasks Due". Any help is much appreciated. I've also posted this at: excel forums and ozgrid forums but with almost no responses. Perhaps it's just too daunting a task...
Here's the pre-programming flow, I just don't know the code to do it:
Scan worksheet "Schedule" for red cells in following Range
H8:I16,H18:I22,H24:I35,H37:I41,H43:I49,H51:I59,H61:I72,H74:I75,H77:I84,H86:I89,H91:H100
If cell = red Then Copy Row A:I
Insert Associated Row into sheet ("Tasks Due")
If red cell is in worksheet "Schedule" H8:I16 then insert copied cells in worksheet "Tasks Due" one below cell = Fuel System
If red cell is in worksheet "Schedule" H18:I22 then insert copied cells in worksheet "Tasks Due" one below cell = Lubrication System
If red cell is in worksheet "Schedule" H24:I35 then insert copied cells in worksheet "Tasks Due" one below cell = Cooling System
If red cell is in worksheet "Schedule" H37:I41 then insert copied cells in worksheet "Tasks Due" one below cell = Exhaust System
If red cell is in worksheet "Schedule" H43:I49 then insert copied cells in worksheet "Tasks Due" one below cell = DC Electrical System
If red cell is in worksheet "Schedule" H51:I59 then insert copied cells in worksheet "Tasks Due" one below cell = AC Electrical System
If red cell is in worksheet "Schedule" H61:I72 then insert copied cells in worksheet "Tasks Due" one below cell = Engine And Mounting
If red cell is in worksheet "Schedule" H74:I75 then insert copied cells in worksheet "Tasks Due" one below cell = Remote Control System
If red cell is in worksheet "Schedule" H77:I84 then insert copied cells in worksheet "Tasks Due" one below cell = Main Alternator
If red cell is in worksheet "Schedule" H86:I89 then insert copied cells in worksheet "Tasks Due" one below cell = General Condition of Equipment
If red cell is in worksheet "Schedule" H91:H100 then insert copied cells in worksheet "Tasks Due" one below cell = Load Bank - ADMIN ONLY
I pasted the following fuinctions from http://www.cpearson.com/Excel/CFColors.htm into my sheet: ActiveCondition , ColorOfCF, and GetStrippedValue. It seems to work to identify a number value of the conditionally colored cell if I use ColorOfCF formula such as =ColorOfCF(H8,FALSE) in a cell in the worksheet. So, now how do I get it to work to automatically scan a certain range of cells for a red (or 255 according to ColorOfCF)? Then if it finds red (or the value 255) it copies the row it's in to another worksheet.
Thanks in advance!
Here's the pre-programming flow, I just don't know the code to do it:
Scan worksheet "Schedule" for red cells in following Range
H8:I16,H18:I22,H24:I35,H37:I41,H43:I49,H51:I59,H61:I72,H74:I75,H77:I84,H86:I89,H91:H100
If cell = red Then Copy Row A:I
Insert Associated Row into sheet ("Tasks Due")
If red cell is in worksheet "Schedule" H8:I16 then insert copied cells in worksheet "Tasks Due" one below cell = Fuel System
If red cell is in worksheet "Schedule" H18:I22 then insert copied cells in worksheet "Tasks Due" one below cell = Lubrication System
If red cell is in worksheet "Schedule" H24:I35 then insert copied cells in worksheet "Tasks Due" one below cell = Cooling System
If red cell is in worksheet "Schedule" H37:I41 then insert copied cells in worksheet "Tasks Due" one below cell = Exhaust System
If red cell is in worksheet "Schedule" H43:I49 then insert copied cells in worksheet "Tasks Due" one below cell = DC Electrical System
If red cell is in worksheet "Schedule" H51:I59 then insert copied cells in worksheet "Tasks Due" one below cell = AC Electrical System
If red cell is in worksheet "Schedule" H61:I72 then insert copied cells in worksheet "Tasks Due" one below cell = Engine And Mounting
If red cell is in worksheet "Schedule" H74:I75 then insert copied cells in worksheet "Tasks Due" one below cell = Remote Control System
If red cell is in worksheet "Schedule" H77:I84 then insert copied cells in worksheet "Tasks Due" one below cell = Main Alternator
If red cell is in worksheet "Schedule" H86:I89 then insert copied cells in worksheet "Tasks Due" one below cell = General Condition of Equipment
If red cell is in worksheet "Schedule" H91:H100 then insert copied cells in worksheet "Tasks Due" one below cell = Load Bank - ADMIN ONLY
I pasted the following fuinctions from http://www.cpearson.com/Excel/CFColors.htm into my sheet: ActiveCondition , ColorOfCF, and GetStrippedValue. It seems to work to identify a number value of the conditionally colored cell if I use ColorOfCF formula such as =ColorOfCF(H8,FALSE) in a cell in the worksheet. So, now how do I get it to work to automatically scan a certain range of cells for a red (or 255 according to ColorOfCF)? Then if it finds red (or the value 255) it copies the row it's in to another worksheet.
Thanks in advance!