VBA code with table name select ... from in EXCEL RRS feed

  • Question

  • I have two tables in a workbook, let's say TblA and TblB I want to know how can I use SQL to extract data from the two table. It seems that I can not directly use the table name (TblA or TblB)

    write"test" is the head name in row 2of TblA

    SQL=select test from [sheetA$A2:X100] ..... then it works

    SQL="select TblA.[test] from TblA" ............ can't work

    pls someone tell me how to use table name  with VBA code in EXCEL?

    Thursday, October 24, 2019 5:40 AM

All replies

  • In response to your previous post, I extracted data from two Tables,
    using Power Query's M programming language.
    Do you now want the same or similar results
    using SQL, VBA, DAX or some other code?

    Friday, October 25, 2019 2:37 AM
  • Hi, 

    I wan to  SQL with  VBA code

    Friday, October 25, 2019 5:52 AM
  • At a basic level, Power Query is just SQL with GUI's.
    See chapter "Query Folding" in this book:
    "Power Query for Power BI and Excel" by Chris Webb.
    VBA is slow.

    Friday, October 25, 2019 2:59 PM