populate cell on worksheet 2 if text is red on worksheet 1
Bernie,
You saved my life! This works beautifully. I made a couple of modifications
to fit my needs:
Sub CalColors()
Dim myCell As Range
' Worksheets("2007 Calendar").Range("B5:H110").ClearContents
' Worksheets("Retail").Range("B5:H110").ClearContent s
' Worksheets("Workplace").Range("B5:H110").ClearCont ents
' Worksheets("Community").Range("B5:H110").ClearCont ents
For Each myCell In Worksheets("2007 Calendar").Range("B5:H110")
If myCell.Font.ColorIndex = 3 Then
Worksheets("Retail").Range(myCell.Address).Value = myCell.Value
End If
If myCell.Font.ColorIndex = 5 Then
Worksheets("Workplace").Range(myCell.Address).Valu e = myCell.Value
End If
If myCell.Font.ColorIndex = 10 Then
Worksheets("Community").Range(myCell.Address).Valu e = myCell.Value
End If
Next myCell
End Sub
--
Thank you,
scrowley(AT)littleonline.com
"Bernie Deitrick" wrote:
S,
The general strategy would be to use a macro - you will need to figure out the correct colorindices
to use. (Hint: use the macro recorder while applying the font colors...)
Sub CalColors()
Dim myCell As Range
Worksheets("Sheet1").Range("C5:H110").ClearContent s
Worksheets("Sheet2").Range("C5:H110").ClearContent s
Worksheets("Sheet3").Range("C5:H110").ClearContent s
Worksheets("Sheet4").Range("C5:H110").ClearContent s
For Each myCell In Worksheets("Master").Range("C5:H110")
If myCell.Font.ColorIndex = 3 Then
Worksheets("Sheet1").Range(myCell.Address).Value = myCell.Value
End If
If myCell.Font.ColorIndex = 6 Then
Worksheets("Sheet2").Range(myCell.Address).Value = myCell.Value
End If
If myCell.Font.ColorIndex = 8 Then
Worksheets("Sheet3").Range(myCell.Address).Value = myCell.Value
End If
If myCell.Font.ColorIndex = 10 Then
Worksheets("Sheet4").Range(myCell.Address).Value = myCell.Value
End If
Next myCell
End Sub
--
HTH,
Bernie
MS Excel MVP
"SCrowley" wrote in message
...
I have the 2007 calendar (jan - dec) on one worksheet (master worksheet). The
text is colored depending on the team it applies to. Copied worksheet 1 to
become Worksheet 2, 3 and 4 (one for each team). Here is the ideal solution:
Worksheet 2 (team 1) If cells C5:H110 on Worksheet 1 contain text that is
RED, populate C5:H110 on Worksheet 2 with only RED text. Worksheet 3 (team 2)
If cells C5:H110 on Worksheet 1 contain text that is GREEN, populate C5:H110
on Worksheet 3 with only GREEN text. Worksheet 4 (team 3) If cells C5:H110 on
Worksheet 1 contain text that is BLUE, populate C5:H110 on Worksheet 4 with
only RED text.
--
Thank you,
scrowley(AT)littleonline.com
|