Que significado tiene del siguiente código
Tengo un código de una macro pero no logro descifrar, me podrían ayudar el paso a paso que hace el código
Sub Generar_CSV()
On Error GoTo ControlErr
Dim NumeroDeFila As Integer
Application.ScreenUpdating = True
Range("B16").Select
'Obtener la fila que contiene el ultimo dato
Selection.End(xlDown).Select
NumeroDeFila = ActiveCell.Row
'Seleccionamos todo el rango de datos para copiarlos en una hoja nueva
'ActiveSheet.Range(Cells(16, 34), Cells(NumeroDeFila, 35)).Select
ActiveSheet.Range(Cells(15, 36), Cells(NumeroDeFila, 36)).Select
Selection.Copy
Range("B16").Select
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:="C:\users\" & NombreUsuarioMaquina & "\Desktop\Pedido_" & Format(Date, "dd-mm-yyyy") & ".csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close
Exit_controlErr:
Exit Sub
ControlErr:
If Err.Number = 1004 Then
MsgBox "El archivo no ha sido guardado", vbInformation, "NO se guardo el archivo"
Else
MsgBox Err.Description, vbCritical, "Error # " & Err.Number
End If
Resume Exit_controlErr
End Sub
1 respuesta
Respuesta de fejoal
