|
Sub 宏1()
Rows("7:1000").Delete Shift:=xlUp
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=Excel Files;DBQ=C:\Users\Administrator\Desktop\6-5\6-5.xlsx;DefaultDir=C:\Users\Administrator\Desktop\6-5;DriverId=1046;Max" _
), Array("BufferSize=2048;PageTimeout=5;")), Destination:=Range("$D$7")). _
QueryTable
.CommandText = "SELECT ID,Title,Genre,Year,RunTime,Rating FROM [DATA$] WHERE [Genre] Like '%" & Range("d4") & "%'"
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = False
.ListObject.DisplayName = "表_1"
.Refresh BackgroundQuery:=False
End With
Cells.EntireColumn.AutoFit
End Sub
|
评分
-
2
查看全部评分
-
|