如此excel宏该如何创建

来源:百度知道 编辑:UC知道 时间:2024/06/27 09:03:27
日常工作导出数据后如下:
Query: Reference Designators
Placement
Number of results: 1004 results found(这三行都是无关紧要的)
回路 编码 X Y 角度 偏移 用量
U38 1003 10.2 20.15 180 0.2 20
C29 0506 100 160 0 0 10(往下还有很多行)
.
.
.
因为每次导出数据时都是有上述那么多,而我知需要以下这5项
回路 编码 X Y 角度
U38 1003 10.2 20.15 180
C29 0506 100 160 0
.
.
.
其他都不要,请问如何创建一个宏,在导出数据后直接点宏,然后出现我想要的??
谢谢~~非常的急~~

Sub Macro1()

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\Administrator\桌面\1.txt", Destination:=Range( _
"A1"))
.Name = "1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 936
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = F