Question : import CSV to excel

This should be very simple.
I have csv file that contains headers for 10 columns and their respective values underneath. I need a macro or vbs code to import only the values from that data into an existing worksheet on cells D4:D13.
thanks

Answer : import CSV to excel

If I understadn you correctly.  You wanting to take row two of the CSV and it populate range D4:D13 in your current workbook.  In other words, multi-columns(1 row) to 1 column(multi rows):

   Dim cwb As New Workbook
   Set cwb = Excel.ActiveWorkbook
   Dim nwb As New Workbook
   Set nwb = Application.Workbooks.Open("C:\MyCSV.csv")
   nwb.ActiveSheet.Range("A2:G2").Select
   Selection.Copy
   cwb.Activate
   Range("D4").Select
   Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
       False, Transpose:=True
       nwb.Close savechanges = False

You'll need to edit the ranges and CSV path of course.

Random Solutions  
 
programming4us programming4us