Hello everyone.
I am trying to create a macro that would import data from a CSV file to a specific worksheet at a specific cell. I found a previous post with a code that successfully imports my CSV file; however, it defaults to importing the data to the first worksheet within the workbook.
For my specific workbook, I have a worksheet named "Market Trends" and would like the data to insert into cell Y15 in the "Market Trends" worksheet. Below is the code I found. I'm hoping someone can help me tweak the code specific to what I'm looking for.
Thank you in advance.
I am trying to create a macro that would import data from a CSV file to a specific worksheet at a specific cell. I found a previous post with a code that successfully imports my CSV file; however, it defaults to importing the data to the first worksheet within the workbook.
For my specific workbook, I have a worksheet named "Market Trends" and would like the data to insert into cell Y15 in the "Market Trends" worksheet. Below is the code I found. I'm hoping someone can help me tweak the code specific to what I'm looking for.
VBA Code:
Sub CSV_Import()
Dim dateien As Variant
Dim i As Long
dateien = Application.GetOpenFilename _
("csv-Dateien (*.csv), *.csv", MultiSelect:=True)
If IsArray(dateien) Then
For i = 1 To UBound(dateien)
Workbooks.Open dateien(i), local:=True
With ThisWorkbook.Sheets(1)
ActiveSheet.UsedRange.Copy Destination:=.Cells(1, .Columns.Count).End(xlToLeft).Offset(, 1)
End With
ActiveWorkbook.Close False
Next i
End If
End Sub
Thank you in advance.