none
Macro to get data from SQL server table RRS feed

  • Question

  • Hello All,

    I need to write a macro to get data from SQL server table. I've a excel spreadsheet that has below column:

    JobNumber
     
    J009871C
    J009851A
    J005695D

    I need to take the first 7 characters (J009871) from the Jobnumber column and match it with the sql server table. If there is a match populate data from sql server table on the same spredsheet. I'm new to VBA.

    Any help is greatly appreciated.

    Thanks.

    Monday, April 11, 2016 10:21 PM

Answers

All replies

  • >>>I need to take the first 7 characters (J009871) from the Jobnumber column and match it with the sql server table. If there is a match populate data from sql server table on the same spredsheet. I'm new to VBA.

    According to your description, I suggest that you could use ActiveX Data Objects (ADO) to import data from Microsoft SQL Server into Microsoft Excel.

    For more information, click here to refer about How to import data from Microsoft SQL Server into Microsoft Excel

    Tuesday, April 12, 2016 1:27 AM
  • You want to match a column in Excel with a SQL table? You must mean a column in the SQL table. What are the columns in the SQL table and what data type?

    Best regards, George

    Tuesday, April 12, 2016 1:09 PM
  • You will find everything you need in the link below.  I think you should bookmark it, actually.

    http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm#Introduction


    MY BOOK

    • Marked as answer by David_JunFeng Thursday, April 21, 2016 7:53 AM
    Saturday, April 16, 2016 1:30 PM