Ayuda con macro con columna con decimales
Hola Dam, necesito de tu ayuda nuevamente. Necesito que la columna "D" cuyos números contengan decimales, me los deje en 2 (0.00)
Sub Planilla_Gral_MI()
Set hactual = Sheets(3)
Dim xfecha
xfecha = InputBox("Ingrese fecha a procesar en formato mm/aaaa:")
Set hdest = Sheets.Add
ActiveSheet.Name = "Planilla_gral_MI"
hactual.Select
ufila = Range("A" & Rows.Count).End(xlUp).Row
ucol = ActiveCell.SpecialCells(xlLastCell).Column
hdest.Columns("C").NumberFormat = "mm\/yyyy"
hdest.Columns("D").NumberFormat = "0.00" <-- (pensé en dejarlo asi pero no quiero
toda la columna "D2" con decimales, solo necesito los datos que aparecen con
decimales que los reduzca a 2 (0.00)
j = 1
For i = 6 To ufila
If Cells(i, 2) <> "" Then
For k = 8 To ucol
If IsNumeric(hactual.Cells(i, 2)) And _
hactual.Cells(4, k) <> "" And _
hactual.Cells(i, 6) = "MI" Then
hdest.Cells(j, 1) = "'" & hactual.Cells(i, "B")
hdest.Cells(j, 2) = "'" & hactual.Cells(4, k)
hdest.Cells(j, 3) = xfecha
If hactual.Cells(i, k) = "" _
Or Not IsNumeric(hactual.Cells(i, k)) Then
hdest.Cells(j, 4) = 0
Else
hdest.Cells(j, 4) = hactual.Cells(i, k)
End If
j = j + 1
End If
Next
End If
Next
hdest.Select
MsgBox "Planilla MI generada correctamente..."
End sub
1 respuesta
Respuesta de Dante Amor
1