0

I am working on a tool to help my business order products. Right now, We have a tool that pulls all of the .csv files from our downloads folder and add them to one excel work book.

I am trying to make it pull one .xlsx file as well. I cannot figure out how to change my Macro code to include this one workbook in our tool. This is the macro that works for .csv files only atm.

Get Sheets - Pulls all downloaded reports into this workbook - Use only on Ordering_Tool Tab

Sheets("Ordering_Tool").Select
Path = "C:\Users\jenel\Downloads\"
Filename = Dir(Path & "*.csv")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
Rajesh Sinha
  • 8,995
  • 6
  • 15
  • 35
  • You mean to say that U wanna to pull one CSV into one Workbook, and so to others !! Or multiple CSV into Multiple Sheets in one Workbook. – Rajesh Sinha Jun 02 '20 at 05:09
  • Multiple CSV into one book plus one .xlsx file. Right now it works to add the .csv files. I just need to add one .xlsx file to it as well if thats possible – nunell17 Jun 02 '20 at 17:18
  • The wise step should one CSV into one sheet,,, in workbook,, if U make 1 workbook to 1 CSV, and trying to pull 1000 then, code will create 1000 workbooks, occupies unnecessary space on disk. – Rajesh Sinha Jun 03 '20 at 07:01

1 Answers1

0

I figured it out, I just needed to Change one line. I changed it to Filename = Dir(Path)

This made it so it would pull every file out of the downloads folder instead of just the .csv files in the downloads folder.