I am trying to or would like to add code into this so it also highlights any changes in Col C

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,079
Office Version
  1. 365
Platform
  1. Windows
Code:
Sub PasteData(ByRef WeekData() As ShiftData, ByRef MFRow As Integer, ByVal ELocal As String, ByVal ERate As String, ByVal Notes As String)
  Set wbmf = Workbooks("Master Time Sheet.xlsm")
    Set wsMF = wbmf.Sheets("Data")
    Dim MFCol As Integer
    Dim PrevData(26) As String
    Dim Idx As Integer
    If VBA.LCase(wsMF.Cells(MFRow, 3).Text) = "office" Then
        Exit Sub
    End If
    MFCol = 3
    wsMF.Cells(MFRow, MFCol).Value = ELocal
    MFCol = MFCol + 1
    wsMF.Cells(MFRow, MFCol).Value = ERate
    MFCol = MFCol + 1
    Idx = 0
    
    For MFCol = 5 To 30
        PrevData(Idx) = wsMF.Cells(MFRow, MFCol).Text
        Idx = Idx + 1
    Next
    MFCol = 5
    For Idx = 0 To 6
    
        If Idx = 0 Then k = 3
        If Idx = 1 Then k = 7
        If Idx = 2 Then k = 11
        If Idx = 3 Then k = 15
        If Idx = 4 Then k = 19
        If Idx = 5 Then k = 22
        If Idx = 6 Then k = 25
        
        If Idx = 5 Or Idx = 6 Then GoTo OT2
        
            If PrevData(k) = "" Or PrevData(k) = WeekData(Idx).job Then
            If WeekData(Idx).ST <> -1 Then
                wsMF.Cells(MFRow, MFCol).Value = WeekData(Idx).ST
            Else
                wsMF.Cells(MFRow, MFCol).Value = ""
            End If
            End If
            MFCol = MFCol + 1
OT2:
[COLOR=#b22222]            If PrevData(k) = "" Or PrevData(k) = WeekData(Idx).job Then
            If WeekData(Idx).OT <> -1 Then
                wsMF.Cells(MFRow, MFCol).Value = WeekData(Idx).OT
            Else
                wsMF.Cells(MFRow, MFCol).Value = ""
            End If
            End If
            MFCol = MFCol + 1
             If PrevData(k) = "" Or PrevData(k) = WeekData(Idx).job Then
            If WeekData(Idx).DT <> -1 Then
                wsMF.Cells(MFRow, MFCol).Value = WeekData(Idx).DT
            Else
                wsMF.Cells(MFRow, MFCol).Value = ""
            End If
            End If
            MFCol = MFCol + 1
             If PrevData(k) = "" Or PrevData(k) = WeekData(Idx).job Then
            If ShtTmp <> 2 Then
                wsMF.Cells(MFRow, MFCol).Value = WeekData(Idx).job
            End If
            End If
                        
            If PrevData(k) <> "" And PrevData(k) <> WeekData(Idx).job Then
                If WeekData(Idx).ST <> -1 Or WeekData(Idx).OT <> -1 Or WeekData(Idx).DT <> -1 Then
                wsMF.Cells(MFRow, MFCol).Interior.Color = Ovrwrtcol
                End If
            End If
            [/COLOR]
            MFCol = MFCol + 1
    Next
    MFCol = MFCol + 3
   wsMF.Cells(MFRow, MFCol).Value = Notes
   Idx = 0
   For MFCol = 5 To 30
    If PrevData(Idx) <> "" Then
        If PrevData(Idx) <> wsMF.Cells(MFRow, MFCol).Text Then
            wsMF.Cells(MFRow, MFCol).Interior.Color = Ovrwrtcol
        End If
    End If
        Idx = Idx + 1
    Next
End Sub


The section in red what it does now if there are changes in Value in any of those columns or cells it will give it interior color. What I'm looking to add in this code somewhere is if there is any changes also in Cell "C" & that can be C4:C1000 or C:C meaning doesn't matter. Any help thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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