Filling entire row based on cell value in another worksheet

lplexe

New Member
Joined
Nov 17, 2020
Messages
4
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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
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?
 

lplexe

New Member
Joined
Nov 17, 2020
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,130,143
Messages
5,640,386
Members
417,139
Latest member
bdmprasenjit

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
Top