Professional Documents
Culture Documents
For i = 1 To ndatos
registro(i, 1) = CDbl((Cells(i + 3, 4)))
registro(i, 2) = CDbl(Cells(i + 3, 10)) ' COLUMNA J
borrador(i) = registro(i, 1)
For j = 1 To nmateriales
If (Cells(i + 3, 12 + j)) = "" Or (Cells(i + 3, 12 + j)) = " " Or (Cells(i + 3, 12 + j)) = " " Or
(Cells(i + 3, 12 + j)) = " " Or (Cells(i + 3, 12 + j)) = " " Then
' MsgBox "celda" & i & "," & j
Else
registro(i, 2 + j) = CDbl(Cells(i + 3, 12 + j))
' MsgBox registro(i, 2 + j)
End If
Next j
Next i
' sumamos datos
Dim smaterialMES(1 To 3000, 1 To 3000) As Single
For i = 1 To ndatos
sregistro(Int(registro(i, 1))) = registro(i, 2) + sregistro(registro(i, 1))
'SUMA MATERIALES
For j = 1 To nmateriales
smaterialMES(Int(registro(i, 1)), j) = registro(i, 2 + j) + smaterialMES(Int(registro(i,
1)), j)
Next j
Next i
' datos sumados, AHORA ordenamos
For i = 1 To ndatos
For j = 1 To ndatos - 1
If borrador(j) > borrador(j + 1) Then
'cambbio para que vaya de manmor a mayor
Dim cambiador As Single
cambiador = borrador(j)
borrador(j) = borrador(j + 1)
borrador(j + 1) = cambiador
Else
End If
Next j
Next i
For i = 1 To ndatos * 2
For j = 1 To ndatos - 1
End If
Next j
Next i
' ahora buscamos el cero y averiguamos cuantos items hay
nitems = 0
For i = 1 To ndatos
If borrador(i) = 0 Then
GoTo 1
Else
nitems = nitems + 1
End If
Next i
1:
MsgBox nitems
'informes semanales
For l = 1 To 4
' sumamos datos
For i = diassemana(l) + 1 To diassemana(l + 1)
sregistroSEMANAS(Int(registro(i, 1)), l) = registro(i, 2) +
sregistroSEMANAS(Int(registro(i, 1)), l)
' determinamos rendmientos por semana
Select Case l
Case 1
For j = 1 To nmateriales
Next j
Case 2
For j = 1 To nmateriales
Next j
Case 3
For j = 1 To nmateriales
Next j
Case 4
For j = 1 To nmateriales
Next j
End Select
Next i
For i = 1 To nitems
Cells(6 + ndatos + i, 4) = borrador(i)
For j = 1 To nmateriales
If smaterialMES(Int(borrador(i)), j) = 0 Then
Else
Cells(6 + ndatos + i, 12 + j) = smaterialMES(Int(borrador(i)), j)
End If
Next j
For j = 1 To ndatos
If borrador(i) = CDbl(Cells(j + 3, 4)) Then
Cells(6 + ndatos + i, 5) = Cells(j + 3, 5)
Cells(6 + ndatos + i, 6) = Cells(j + 3, 6)
GoTo NOMBRE
End If
Next j
NOMBRE:
Cells(6 + ndatos + i, 10) = sregistro(borrador(i))
Next i
For i = 1 To 2000
contador = 0
For i = 1 To 2000
filador = 5 * (contador)
'mostramos fila el item
Cells(filador + 850, 4) = i
'MsgBox i
Cells(filador + 850, 10) = sregistroSEMANAS(i, 1)
Cells(filador + 850 + 1, 10) = sregistroSEMANAS(i, 2)
Cells(filador + 850 + 2, 10) = sregistroSEMANAS(i, 3)
Cells(filador + 850 + 3, 10) = sregistroSEMANAS(i, 4)
For j = 1 To nmateriales
If Val(sregistroSEMANAS(i, 1)) = 0 Then
Cells(filador + 850, 12 + j) = 0
Else
Cells(filador + 850, 12 + j) = materiales01(i, j) / sregistroSEMANAS(i, 1)
End If
Next j
End If
Next i
End Sub