Select criteria & Delete Row

Joined
Feb 26, 2007
Messages
1
Reaction score
0
Hello,


I know that it will be a quick answer but I don't know to fix it...

I would like to import a txt and format it:
Step by step

Import txt --> ok
Copy top text from another sheet --> ok
Autofilter & Autofit --> ok
Select criteria & Delete --> nok

Could you help me? Thanks in advance

' Import txt
Sub ImportarTXT()
ruta = Sheets("info").Range("B1")
If ruta = vacia Then
MsgBox ("la celda B1 de la hoja INFO no tiene una ruta correcta! )) ")
Exit Sub
Else
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" _
& ruta, Destination _
:=Range("A2"))
.Name = filenametxt
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=True
End With
End If

' Copy top txt & DEL next 2 rows
Sheets("info").Select
Range("A2:E2").Select
Selection.Copy
Sheets("Hoja1").Select
ActiveSheet.Paste
Rows("2:3").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A1").Select

' Exec Autofilter & Autofit
Selection.AutoFilter
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
Range("A1").Select

' Select "sysidX-sysidY" & DEL
Selection.AutoFilter Field:=1, Criteria1:="sysidX-sysidY"
Selection.EntireRow.Delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top