0

I have a SQL Query, which I want to use in VBA to load the data into Excel, the problem is that when the load is done the data in Excel is with the wrong type. For example, where it needs to be a date, it remains an integer, where an integer is a date. Is there any way to fix this? Example my query:

sql = " SELECT DATA, ITEM, COMPANY, SALES FROM SALES "
1
  • 1
    Format the date column afterwards with something like Range("A:A").NumberFormat = "dd/mm/yyyy" Commented Jan 31, 2020 at 11:03

1 Answer 1

2

You will have to format cells as per date format. Also ensure that values are correct in your query output.

Sheet1.Range("A2", "A100").NumberFormat = "yyyy-mm-dd"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.