I've got a problem on Visual Basic code. Never used it, and I'm supposed to edit this code below. I need to grey out the fields that have been transferred to the first page from pages (1,2,3) on pages 1,2,3. So after a field is transferred to page one, it should be greyed from the page it was transferred from. Only "Required fields would be transferred. Can I get help?

Sub copyTReK()
Dim LR As Long, i As Long, Done As Boolean
With Sheets("TReK Training Course")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 18 To LR
    If .Range("C" & i).Value = "Required" Then
        .Range("A" & i).Resize(, 6).copy
        If Done Then
            Sheets("Payload Developer Required").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
        Else
            Sheets("Payload Developer Required").Range("A20").PasteSpecial Paste:=xlPasteValues
            Done = True
        End If
    End If
    Next i
End With
End Sub
Sub copyConsole()
Dim LR As Long, i As Long, Done As Boolean
With Sheets("Console Tools Training Course")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 18 To LR
    If .Range("C" & i).Value = "Required" Then
        .Range("A" & i).Resize(, 6).copy
       ' If Done Then
            Sheets("Payload Developer Required").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
       ' Else
        '    Sheets("Payload Developer Required").Range("A20").PasteSpecial Paste:=xlPasteValues
         '   Done = True
        'End If
    End If
    Next i
End With
End Sub
Sub copyRealtime()
Dim LR As Long, i As Long, Done As Boolean
With Sheets("Real Time Operations")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 17 To LR
    If .Range("C" & i).Value = "Required" Then

Since you have a variable to determine if its done, you should create another if statement within that block to verify if done is try (1) or false (0)

 If Done = True Then
 ' Change the color of the field here.
 Else
 ' Its wasn't copied then.
 End If.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.