Forum Discussion
PaulD0925
Sep 10, 2025Copper Contributor
Excel Code trying to copy cell data from one sheet to another based on 2 criteria
Sheet "My Plan" Sheet "Tracker" I have several plans in external files that I have code for to select and import 1 to sheet "My Plan". I am using cell E6 as a named cell called PlanName and I sele...
peiyezhu
Sep 26, 2025Bronze Contributor
I have no windows PC to debug fully EXCEL vba api.BUT I have found there are sapces after Test like "Test " in table Track.
x="ADODB.Connection"
Set Conn = CreateObject(x)
Conn.Open "Provider=Microsoft.Ace.OLEDB.12.0;Extended Properties='Excel 12.0;';Data Source=" & ThisWorkbook.FullName
sql="select "
sql=sql & " * from [Tracker$]"
sql= sql & " where f6 like ""Test%"""
'olny add % wildcard to match "Test "
set Rst=Conn.Execute(sql)
ActiveCell.CopyFromRecordset Rst
sql="select "
sql=sql & " * from [My Plan$]"
set Rst=Conn.Execute(sql)
ActiveCell.CopyFromRecordset Rst
peiyezhu
Sep 26, 2025Bronze Contributor
Additionly,I guess you can upload workbooks to this forum instead of 1 driver.