With Sheets(rStartCell.Parent.Name)
.Cells.ClearContents
Dim strStartlocation As String
Dim lngColCounter As Long
For lngColCounter = 0 To rs.Fields.Count - 1
rStartCell.Offset(0, lngColCounter) = rs.Fields(lngColCounter).Name
Next lngColCounter
rStartCell.Offset(1).CopyFromRecordset rs
End With
linex:
cn.Close
Set cn = Nothing
Set rs = Nothing
End Sub
Sub Test()
iQ = "select * from [資料庫$]" '''''''你的資料在sheets("資料庫")里
Set iAddress = Sheets("sheet4").Range("A1") '''找到的資料放在sheet4.cells(1,1)
iSql
End Sub