Excel vba to color row based on wbs level

Closed
Ebti59 Posts 5 Registration date Tuesday 20 August 2019 Status Member Last seen 26 August 2019 - 21 Aug 2019 à 13:54
 Blocked Profile - 21 Aug 2019 à 14:30
Hello
I need a macro to change row color based on "Level" column.

Thanks
Ebti
Related:

1 response

Blocked Profile
21 Aug 2019 à 14:30
Here is a simple one. It looks for "one" in cell A of each row.

Sub colortherow ()
Thecounter=findlastrow ("yoursheet")
for each RC in Range ("A1:A"& thecounter)
If RC.value ="one" then
RC.entirerow.interior.color=vbRed
End if
Next
End sub

Function findlastrow (whatsheet)
Findlastrow=thisworkbook.worksheets(whatsheet).cells.(rows.count,1).end (xlUp).row
End function

Very simple.