Sumar hasta encontrar espacio vacío parte 2
Hola expertos,
Me podrían ayudar con esta macro:
Private Sub CommandButton1_Click()
fila = 3
filafinal = Cells(65000, 2).End(xlUp).Row
Do While filafinal >= fila
For x = 5 To 7
Cells(fila, x - 3).Select
If Selection.Offset(1, 0) <> "" Then
Range(Selection, Selection.End(xlDown)).Select
End If
suma = 0
For Each valor In Selection
suma = suma + valor
Next
Cells(fila - 1, x) = suma
Next x
Cells(fila, 1).End(xlDown).Select
Selection.End(xlDown).Select
fila = Selection.Row
Loop
Range("a1").Select
End Sub
cuando suma mas de 1 fila
187.97 224.77 262.55
48.00 72.00 96.00
60.00 72.00 84.00
75.00 75.00 75.00
4.97 5.77 7.55
4295.29 28.40 77.09
4234.00 2.34 5.90
3.00 4.00 5.00
0.15 0.20 0.25
5.00 6.00 7.00
0.10 0.20 0.30
46.00 6.00 46.00
0.05 0.10 0.15
0.03 0.04 0.05
0.36 0.72 1.44
6.00 8.00 10.00
0.60 0.80 1.00
67.32 82.46 103.10
55.00 66.00 82.50
1.80 2.40 3.00
0.20 0.30 0.40
0.60 0.80 1.00
8.00 10.00 12.00
0.72 0.96 1.20
1.00 2.00 3.00
34.05 46.48 58.91
9.37 11.72 14.07
1.20 2.40 3.60
6.00 8.00 10.00
0.08 0.16 0.24
0.20 0.30 0.40
0.20 0.30 0.40
0.20 0.40 0.60
0.20 0.40 0.60
4.00 6.00 8.00
2.00 4.00 6.00
0.10 0.20 0.30
10.00 12.00 14.00
0.50 0.60 0.70
cuando suma en un caso 1 fila: (se raya la macro)
108.00 144.00 180.00
48.00 72.00 96.00
60.00 72.00 84.00
4.97 5.77 7.55
4.97 5.77 7.55
4234.00 2.34 5.90
3.00 4.00 5.00
0.15 0.20 0.25
5.00 6.00 7.00
0.10 0.20 0.30
46.00 6.00 46.00
0.05 0.10 0.15
0.03 0.04 0.05
0.36 0.72 1.44
6.00 8.00 10.00 0.60 0.80 1.00
0.60 0.80 1.00
55.00 66.00 82.50
1.80 2.40 3.00
0.20 0.30 0.40
0.60 0.80 1.00
8.00 10.00 12.00
0.72 0.96 1.20 1.00 2.00 3.00
1.00 2.00 3.00
9.37 11.72 14.07
1.20 2.40 3.60
6.00 8.00 10.00
0.08 0.16 0.24
0.20 0.30 0.40
0.20 0.30 0.40
0.20 0.40 0.60
0.20 0.40 0.60
4.00 6.00 8.00
2.00 4.00 6.00
0.10 0.20 0.30
10.00 12.00 14.00 0.50 0.60 0.70
0.50 0.60 0.70
Saludos y gracias de antemano
Me podrían ayudar con esta macro:
Private Sub CommandButton1_Click()
fila = 3
filafinal = Cells(65000, 2).End(xlUp).Row
Do While filafinal >= fila
For x = 5 To 7
Cells(fila, x - 3).Select
If Selection.Offset(1, 0) <> "" Then
Range(Selection, Selection.End(xlDown)).Select
End If
suma = 0
For Each valor In Selection
suma = suma + valor
Next
Cells(fila - 1, x) = suma
Next x
Cells(fila, 1).End(xlDown).Select
Selection.End(xlDown).Select
fila = Selection.Row
Loop
Range("a1").Select
End Sub
cuando suma mas de 1 fila
187.97 224.77 262.55
48.00 72.00 96.00
60.00 72.00 84.00
75.00 75.00 75.00
4.97 5.77 7.55
4295.29 28.40 77.09
4234.00 2.34 5.90
3.00 4.00 5.00
0.15 0.20 0.25
5.00 6.00 7.00
0.10 0.20 0.30
46.00 6.00 46.00
0.05 0.10 0.15
0.03 0.04 0.05
0.36 0.72 1.44
6.00 8.00 10.00
0.60 0.80 1.00
67.32 82.46 103.10
55.00 66.00 82.50
1.80 2.40 3.00
0.20 0.30 0.40
0.60 0.80 1.00
8.00 10.00 12.00
0.72 0.96 1.20
1.00 2.00 3.00
34.05 46.48 58.91
9.37 11.72 14.07
1.20 2.40 3.60
6.00 8.00 10.00
0.08 0.16 0.24
0.20 0.30 0.40
0.20 0.30 0.40
0.20 0.40 0.60
0.20 0.40 0.60
4.00 6.00 8.00
2.00 4.00 6.00
0.10 0.20 0.30
10.00 12.00 14.00
0.50 0.60 0.70
cuando suma en un caso 1 fila: (se raya la macro)
108.00 144.00 180.00
48.00 72.00 96.00
60.00 72.00 84.00
4.97 5.77 7.55
4.97 5.77 7.55
4234.00 2.34 5.90
3.00 4.00 5.00
0.15 0.20 0.25
5.00 6.00 7.00
0.10 0.20 0.30
46.00 6.00 46.00
0.05 0.10 0.15
0.03 0.04 0.05
0.36 0.72 1.44
6.00 8.00 10.00 0.60 0.80 1.00
0.60 0.80 1.00
55.00 66.00 82.50
1.80 2.40 3.00
0.20 0.30 0.40
0.60 0.80 1.00
8.00 10.00 12.00
0.72 0.96 1.20 1.00 2.00 3.00
1.00 2.00 3.00
9.37 11.72 14.07
1.20 2.40 3.60
6.00 8.00 10.00
0.08 0.16 0.24
0.20 0.30 0.40
0.20 0.30 0.40
0.20 0.40 0.60
0.20 0.40 0.60
4.00 6.00 8.00
2.00 4.00 6.00
0.10 0.20 0.30
10.00 12.00 14.00 0.50 0.60 0.70
0.50 0.60 0.70
Saludos y gracias de antemano
1 Respuesta
Respuesta de Cadipas spain
1