Check the days worked

Buskopan

Board Regular
Joined
Aug 4, 2014
Messages
54
Hello again.

List contains the names. Range L8:L127 shows the number of days each person worked. Range M8:M127 shows the company code.
Codes are different. I need macro to check range with company codes (M8:M127) and if the cell contains text "GSF - CDC" check the L range for number of days person worked. And then if it is more than 14 days highlight that range from A to M in green

PS range L8:L127 is text.

2646cg1.jpg
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Code:
Sub checkDaysWorked()

    Dim chkRng As Range


    Set chkRng = Range(Cells(8, 12), Cells(Cells(Rows.Count, "L").End(xlUp).Row, 12))
    
    chkRng.Select
    
    For Each cell In chkRng
    
        Select Case cell.Offset(0, 1)
            Case "GSF - CDC"
                If CLng(cell.value) > 14 Then Range(Cells(cell.Row, 1), Cells(cell.Row, 13)).Interior.Color = vbGreen
            Case Else
        End Select
    
    Next cell
    


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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