Filling entire row based on cell value in another worksheet

lplexe

New Member
Joined
Nov 17, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I wonder if there's a way to write the code for filling entire row based on cell value (TRUE) which is stated in another worksheet. I'm working on highliting rows with names of people who belong to different time shifts. In "Sheet1" I created a list of people who are working and next to them I created set of check boxes to state on which shift they're working (they have statement connection with specific cells). Now I Try to create macro which would fill entire row of this person in another worksheet but nothing works so far. The best I could think of is:

Sub ColorRows()

Worksheets("Sheet 2").Select
If Worksheets("Sheet 1").Cells(H4) = True Then
Cells(4).EntireRow.Interior.ColorIndex = 255
Elseif Worksheets("Sheet 1").Cells(J4) = True Then
Cells(4).EntireRow.Interior.ColorIndex = 255
Elseif Worksheets("Sheet 1").Cells(L4) = True Then
Cells(4).EntireRow.Interior.ColorIndex = 255
Endif

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You need to post an image of your source worksheet and your destination worksheet, or give a better explanation of where the data is located on the source sheet and where you want it to go to on the destination sheet. Also, do you want the code to loop so that each column H is tested for TRUE for each employee? How many columns of data and which columns are to be copied to the destination sheet? Have you thought about using the macro recorder to create the procedure?
 
Upvote 0
You need to post an image of your source worksheet and your destination worksheet, or give a better explanation of where the data is located on the source sheet and where you want it to go to on the destination sheet. Also, do you want the code to loop so that each column H is tested for TRUE for each employee? How many columns of data and which columns are to be copied to the destination sheet? Have you thought about using the macro recorder to create the procedure?
I would like to highlite entire row of a person in this worksheet (Sheet 2)
IMG_2242-min.JPG

Based on these values in 'set up' worksheet (Sheet 1). I also missed one condition in the end that would leave the row without filling if none of these conditions would be true.
IMG_2241-min.JPG
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top