Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2009, 15:23
GEV76
 
Fecha de Ingreso: marzo-2009
Mensajes: 15
Antigüedad: 15 años, 2 meses
Puntos: 0
Consulta sobre repetición

Hola, hice esta macro:
Public Datos As Workbook
Public Sub linedia(ByVal dia As String)
Dim evalFA As Integer, eval As Integer, score As Integer, contar As Integer, counter As Integer, scoreFA As Integer
contar = Worksheets("Datos").Cells(1, 104).Value
For Ag = 3 To 4
If Not IsEmpty(Worksheets("Lines").Cells(Ag, 1).Value) Then
For counter = 2 To contar
If Worksheets("Datos").Cells(counter, 2).Value = Worksheets("Lines").Cells(2, (1 + (dia))).Value Then
If Worksheets("Datos").Cells(counter, 9).Value = Worksheets("Lines").Cells(Ag, 1).Value Then
eval = eval + 1

If Worksheets("Datos").Cells(counter, 17).Value Then
evalFA = evalFA + 1
If Worksheets("Datos").Cells(counter, 17).Value Then
scoreFA = scoreFA + Worksheets("Datos").Cells(counter, 17).Value
End If
End If
End If
End If
Next
End If

Worksheets("Lines").Cells(Ag, 1 + (dia)) = eval
If evalFA <> 0 Then
Worksheets("Lines").Cells(Ag, 2 + (dia)) = scoreFA / evalFA
Else
Worksheets("Lines").Cells(Ag, 1 + (dia)) = ""
End If

eval = 0
evalFA = 0
scoreFA = 0
Next
End Sub


Funciona bien hasta esta parte:

Worksheets("Lines").Cells(Ag, 1 + (dia)) = eval (esto lo hace perfecto porque pega los datos cada dos columnas y respeta los días)
If evalFA <> 0 Then
Worksheets("Lines").Cells(Ag, 2 + (dia)) = scoreFA / evalFA (acá es donde tengo el problema, porque pega el dato, e inmediatamente lo borra, como si la estuviese sobreescribiendo con otro dato y no sé cual es el error)
Else
Worksheets("Lines").Cells(Ag, 1 + (dia)) = ""
End If

Gracias por el tiempo a quien pueda darme un mano...