marcvanderpeet12
Member
Dear all,
I have the following VBA code.
--
>>> use code - tags <<<
--
This load data from a .csv file. Works pretty fine by the thing is that the .csv name changes. I am looking to change the code so it takes the first and only .csv in the dir (instead of name). Any thoughts on what I should change?
I have the following VBA code.
--
>>> use code - tags <<<
Code:
Sub load_excel()
Dim Wb1 As Workbook
'Dont update the screen - makes it work faster
Application.ScreenUpdating = False
'Open the other workbook
'Input the FULL path to the file, including its extension
'Grab the first and only Excel sheet.
Set Wb1 = Workbooks.Open("P:\Projects\PROJECTEN (cl] Continue\Continue\Finance\Verwerken\2023-07-17-09-41-59-bunq-transactieoverzicht.csv")
'You can do whatever you want here with the other workbook - it is now open.
'Determine how many rows
'This just copies some cells.
Wb1.Sheets(1).Range("A1:A10").Copy
'Close the workbook from which we just got some data and make sure not to save it in case accidental changes were made to it.
Wb1.Close SaveChanges:=False
'Turn on screen updating again - makes Excel usable
Application.ScreenUpdating = True
End Sub
This load data from a .csv file. Works pretty fine by the thing is that the .csv name changes. I am looking to change the code so it takes the first and only .csv in the dir (instead of name). Any thoughts on what I should change?
Last edited by a moderator: