buen dia Dam que pena contijo este es el código que grabe en que parte debo colocar la sintaxis
para que funcione y no me muestre el mensaje de depurar o finalizar
Sub ventassur()
'
' ventassur Macro
'
'
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:="TEXT;Q:\UN043158.PM1", _
Destination:=Range("$A$1"))
.Name = "UN043158"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(20, 28, 3, 13, 28, 15, 10)
.TextFileTrailingMinusNumbers = True
If condición Then
MsgBox ("no olvide que la ext debe ser .PV1")
End If
.Refresh BackgroundQuery:=False
End With
ActiveCell.FormulaR1C1 = "COD LINEA"
Range("B1").Select
ActiveCell.FormulaR1C1 = "DESCRIPCION"
Range("C1").Select
ActiveCell.FormulaR1C1 = "UM"
Range("D1").Select
ActiveCell.FormulaR1C1 = "CANTIDAD"
Range("E1").Select
ActiveCell.FormulaR1C1 = "VLR BRUTO"
Range("F1").Select
ActiveCell.FormulaR1C1 = "DESCUENTO"
Range("G1").Select
ActiveCell.FormulaR1C1 = "IMPUESTOS"
Range("H1").Select
ActiveCell.FormulaR1C1 = "TOTAL"
Columns("A:H").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$H$125").AutoFilter Field:=1, Criteria1:=Array( _
"--------------------", "+------------------", "|", "| C.O. :", _
"| Empresa :", "| Tipo Inventario :", "| UN043158.PM1", "| UNO - VER 7.2." _
, "|LINEA", "+-------------------", "Total C.O.", "Total Empresa", _
"Total Inventario", "="), Operator:=xlFilterValues
Rows("2:260").Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter
Selection.Replace What:="PROMOCION DE FRUVER", Replacement:="FRUVER", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Range("I2").Select
ActiveCell.FormulaR1C1 = "=SUMIF(C[-7],""FRUVER"",C[-1])"
Selection.Copy
Range("I2").Select
Application.CutCopyMode = False
Selection.Copy
Range("H2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I2").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Range("A1:H1").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A1:H260").Select
Selection.Copy
Sheets("DATOS").Select
Range("AB5").Select
ActiveSheet.Paste
Range("AB5").Select
Application.DisplayAlerts = False
elim = 1
For i = 1 To Sheets.Count
If Left(Sheets(elim).Name, 4) = "Hoja" Then
Sheets(elim).Delete
Else
elim = elim + 1
End If
Next
Application.DisplayAlerts = True
End Sub