Jesienouski
New Member
- Joined
- Mar 9, 2011
- Messages
- 14
I have a small macro that loops through and concatenates 4 different values into a single cell on worksheet. Some of the values could either be "Pass" or "Fail" as input into another part of the workbook. I would like the concatenation to have the "Pass" value to be green and the "Fail" value to be red within the concatenation. Below is the code
The values that are brought over from Sheet4 are the ones that would need to be colored. (Sheet4.Cells(I, 3) & " - " & Sheet4.Cells(I, 6)). Is there an easy way to acomplish this? The cells in Sheet 4 are already conditionally formated to color the font red and green if that helps.
Thanks!
Code:
Sub BuildDocPackageLists()
Dim I As Integer
Dim R As Integer
Dim B As Integer
Dim C As Integer
B = 1
C = 17
Sheet6.Range("Q2:Y50").ClearContents
Do Until B = 10
Sheet6.Cells(26, 2).Value = Sheet6.Cells(B, 6)
R = 2
I = 2
Do Until IsEmpty(Sheet5.Cells(I, 6))
If Sheet5.Cells(I, 7).Value = "Yes" Then
Sheet6.Cells(R, C).Value = Sheet5.Cells(I, 1).Value _
& " - " & Sheet5.Cells(I, 2).Value & " - " & _
Sheet4.Cells(I, 3) & " - " & Sheet4.Cells(I, 6)
R = R + 1
End If
I = I + 1
Loop
C = C + 1
B = B + 1
Loop
Sheet6.Cells(26, 2).Value = Sheet6.Cells(1, 6)
Application.ActivePrinter = "Adobe PDF on Ne03:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne03:"",,TRUE,,FALSE)"
End Sub
Thanks!