It's kind of lenghty but I''l post the whole sub below. Basically wha
I'm trying to do is to ensure the that the cells remain "." if th
condition can not be applied to all 8 cells.
You can see where I tried the " If WorksheetFunction.CountIf(.
statement" but it still failed in some circumstances. Meaning tha
"One" and two had blended within the eight cells.
I want to make a match on all 8 cells or show the value "." in it'
place.
Like This
OneOneOneOneOneOneOneOne
Not This
OneOneOneTwoTwoTwoTwoTwo
If it Fails
OneOneOne . . . .or
Two Two Two . . . etc.
Thanks
Sub Tasks()
Dim need As Integer
Application.ScreenUpdating = False
skillx = 9
timeStart = -1
timeStart2 = 1
For period = 1 To 12
timeStart = timeStart + 8
timeStart2 = timeStart2 + 6
For skilly = 104 To 124
skillNam = Sheet236.Cells(skillx, skilly).Value
need = Sheet236.Cells(period + 318, skilly - 97).Value
Sheet236.Cells(period + 304, skilly - 97).Value
If skillNam = "ENG" Then
Eng period, timeStart2, skilly, need
ElseIf skillNam = "IND" Then
Ind period, timeStart, skilly, need
Else
OtherSkill period, timeStart, skilly, skillNam, need
End If
Next skilly
Next period
Application.ScreenUpdating = True
For Each cell In Range("G11:CX287")
If cell.Value = "." Then
With cell.Offset(0, 0).Interior
.Pattern = xlGrid
.PatternColor = RGB(225, 225, 0)
End With
End If
Next
'MsgBox "Complete"
End Sub
Public Sub Eng(ByVal period As Integer, ByVal timeStart2 As Integer
ByVal skilly As Integer, ByVal need As Integer)
Dim counter As Integer
Dim did As Boolean
Dim n As Integer
With Sheet236
For x = 11 To 298
counter = 0
did = False
For n = 1 To timeStart2
If .Cells(x, n).Value = "ENG" Then
did = True
End If
Next n
If .Cells(x, skilly).Value = "x" And did = False Then
For y = timeStart2 To timeStart2 + 5
If WorksheetFunction.CountIf(.Range(.Cells(x, y), .Cells(x, y
6)), ".") > 1 _
And .Cells(x, y).Value = "." _
And counter < 6 _
And need > 0 Then
.Cells(x, y).Value = "ENG"
counter = counter + 1
need = need - 1
End If
Next y
End If
Next x
End With
pack
End Su