Thanks a lot for your reply Gavona.
I was working on it. Down, my little program, but it spends much time. With this I try to explain my little proyect. I make the file that contains the data with awk. Now what I want in excel application is to fill the cells with colors depends of the day and if is increased or decresed a 10% with respect to the average value.
Is It possible to do this more efficient?
(2,4) 125 128
switch |h1| hT1| n2| nT2| f3| fT3| h51| hT5| ..... h| hT| f| ft| n| nT
item1 . . . . . . . . ..... . . . . . .
item2 . . . . . . . . ..... . . . . . .
item3 . . . . . . . . ..... . . . . . .
item4 . . . . . . . . ..... . . . . . .
item 2060
' H means capable day
' N means non capable day
' F means holiday
' S means Saturday
' HCp average calls capable day
' HSp average seconds capable day
' NCp average calls non capable day
' NSp average seconds non capable day
' FCp average calls holiday
' FSp average seconds holiday
' SCp average calls saturday
' SSp average secons holiday
Sub Color()
'
'
'
'
Dim var As String
Dim i, j, k As Integer
i = 2 ' row head
j = 4 ' column head
var = InputBox("Input your opcion H N F S T")
MsgBox ("the value is " & var)
Select Case var
Case "H"
While (i <= 2060) ' Rows It value can be change I would like to do this dynamically
A:
While (j <= 125) ' Columns , March 1 Calls, March 1 Seconds .......................May 1 Calls, May 1 Seconds. It value can be change I would like to do this dynamically
x = 0
While (x <= 7) ' Columns HCp HSp NCp NSp FCp FSp SCp SSp averages
If (Cells(2, j) Like "Calls*H*") And (Cells(2, 128 + x) Like "*HCp*") Then ' head
If Cells(i + 1, j) = 0 Then
Cells(i + 1, j).Interior.ColorIndex = 3 ' values
j = j + 1
GoTo A:
End If
'If Cells(i + 1, j) < Cells(i + 1, 128 + x) Then
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) > 10) Then
Cells(i + 1, j).Interior.ColorIndex = 46
j = j + 1
GoTo A:
End If
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) < -10) Then
Cells(i + 1, j).Interior.ColorIndex = 50
j = j + 1
GoTo A:
End If
End If
If (Cells(2, j) Like "Minutes*H*") And (Cells(2, 128 + x) Like "*HSp*") Then
'Cells(i + 1, j) < Cells(i + 1, 128 + x)
If Cells(i + 1, j) = 0 Then
Cells(i + 1, j).Interior.ColorIndex = 3
j = j + 1
GoTo A:
End If
If Cells(i + 1, 128 + x) = 0 Then
Cells(i + 1, 128 + x).Interior.ColorIndex = 3
j = j + 1
GoTo A:
End If
'If Cells(i + 1, j) < Cells(i + 1, 128 + x) Then
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) > 10) Then
Cells(i + 1, j).Interior.ColorIndex = 46
j = j + 1
GoTo A:
End If
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) < -10) Then
Cells(i + 1, j).Interior.ColorIndex = 50
j = j + 1
GoTo A:
End If
End If
x = x + 1
Wend
j = j + 1
Wend
j = 4
i = i + 1
Wend
Case "N", "n"
While (i <= 2060)
B:
While (j <= 125)
x = 0
While (x <= 7)
If (Cells(2, j) Like "Calls*N*") And (Cells(2, 128 + x) Like "*NCp*") Then
'Cells(i + 1, j) < Cells(i + 1, 128 + x)
If Cells(i + 1, j) = 0 Then
Cells(i + 1, j).Interior.ColorIndex = 3
j = j + 1
GoTo B:
End If
'If Cells(i + 1, j) < Cells(i + 1, 128 + x) Then
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) > 10) Then
Cells(i + 1, j).Interior.ColorIndex = 46
j = j + 1
GoTo B:
End If
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) < -10) Then
Cells(i + 1, j).Interior.ColorIndex = 50
j = j + 1
GoTo B:
End If
End If
x = x + 1
Wend
j = j + 1
Wend
j = 4
i = i + 1
Wend
Case "F", "f"
While (i <= 2060)
C:
While (j <= 125)
x = 0
While (x <= 7)
If (Cells(2, j) Like "Calls*F*") And (Cells(2, 128 + x) Like "*FCp*") Then
'Cells(i + 1, j) < Cells(i + 1, 128 + x)
If Cells(i + 1, j) = 0 Then
Cells(i + 1, j).Interior.ColorIndex = 3
j = j + 1
GoTo C:
End If
'If Cells(i + 1, j) < Cells(i + 1, 128 + x) Then
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) > 10) Then
Cells(i + 1, j).Interior.ColorIndex = 46
j = j + 1
GoTo C:
End If
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) < -10) Then
Cells(i + 1, j).Interior.ColorIndex = 50
j = j + 1
GoTo C:
End If
End If
x = x + 1
Wend
j = j + 1
Wend
j = 4
i = i + 1
Wend
Case "S", "s"
While (i <= 2060)
D:
While (j <= 125)
x = 0
While (x <= 7)
If (Cells(2, j) Like "Calls*S*") And (Cells(2, 128 + x) Like "*SCp*") Then
'Cells(i + 1, j) < Cells(i + 1, 128 + x)
If Cells(i + 1, j) = 0 Then
Cells(i + 1, j).Interior.ColorIndex = 3
j = j + 1
GoTo D:
End If
'If Cells(i + 1, j) < Cells(i + 1, 128 + x) Then
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) > 10) Then
Cells(i + 1, j).Interior.ColorIndex = 46
j = j + 1
GoTo D:
End If
If (100 - (Cells(i + 1, j) / Cells(i + 1, 128 + x) * 100) < -10) Then
Cells(i + 1, j).Interior.ColorIndex = 50
j = j + 1
GoTo D:
End If
End If
x = x + 1
Wend
j = j + 1
Wend
j = 4
i = i + 1
Wend
End Select
End Sub
Thanks malpa