Crear bucle para una macro
La macro esta excelente, pero hay un inconveniente, ¿que pasa cuando el monto es por ejemplo 20,000, la macro me dejara una celda con un monto de 16,500, y yo quiero que la macro busque hasta que no haya ninguna celda con montos mayores a 3500. Te anexo la macro:
Sub RevisarMontos()
'Por.Dante Amor
Set h1 = Sheets("monto")
Set h2 = Sheets("resultado")
h2.Cells.ClearContents
h1.Rows(1).Copy h2.Rows(1)
j = 2
wmax = 3500
For i = 2 To h1.Range("A" & Rows.Count).End(xlUp).Row
h1.Rows(i).Copy h2.Rows(j)
j = j + 1
If h1.Cells(i, "C") > wmax Then
h2.Cells(j, "A") = h1.Cells(i, "A") + 1
h2.Cells(j, "B") = h1.Cells(i, "B")
h2.Cells(j, "C") = h1.Cells(i, "C") - wmax
h2.Cells(j - 1, "C") = h2.Cells(j - 1, "C") - h2.Cells(j, "C")
j = j + 1
End If
Next
h2.Select
MsgBox "Fin"
End Sub
1 respuesta
Respuesta de Dante Amor
1