+ Reply to Thread
Results 1 to 4 of 4

Create a csv file using VBA or Macro

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    uk
    MS-Off Ver
    Office 2010 pro
    Posts
    2

    Question Create a csv file using VBA or Macro

    Can anyone please help to create a csv file

    I got an excel sheet with values like below:
    The column names below will be different, for understanding i had put column name ans type as same.

    Model P S I adj (column name will be different)
    A 10 10 5 6
    B 15 5 18 4
    C 30 20 15 8

    I need to create a csv file in the below format, the first column need to hard code with value 1, others values from the excel, it can some more values with hard coding.

    Cd Model Type Qty
    1 A P 10
    1 A S 10
    1 A I 5
    1 A ADJ 6
    1 B P 15
    1 B S 5
    1 B I 18
    1 B ADJ 4
    1 C P 30
    1 C S 20
    1 C I 15
    1 C ADJ 8

    Can anyone please help...very urgent.

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Create a csv file using VBA or Macro


    Attach a source workbook and a desired .csv file from this source workbook …

  3. #3
    Registered User
    Join Date
    09-22-2014
    Location
    uk
    MS-Off Ver
    Office 2010 pro
    Posts
    2

    Re: Create a csv file using VBA or Macro

    I have uploaded a sample excel and Output.csv file.

    Sample Excel has got 2 sheet, Config & Data.

    In the output file, the first 2 column values are coming from the Config sheet and other from Data Sheet. In the Type column P,S,I,ADJ can be hard coded. (I just put this as the column name in the sample excel)

    Thanks in advance.
    Attached Files Attached Files
    Last edited by asubash; 10-20-2014 at 07:46 AM.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this demonstration !


    Code to paste in Data worksheet module :
    Please Login or Register  to view this content.
    Do you like ? So thanks to click on bottom left star icon « Add Reputation » !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to create a file from base file if data is availabe in defined columns
    By shansakhi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2014, 10:55 PM
  2. Create folder, excel file, pdf file, clear details macro
    By cemartinho in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2013, 08:52 AM
  3. [SOLVED] Macro to create text file and write contents of selected cells to the file
    By m@cro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2013, 10:21 AM
  4. Replies: 3
    Last Post: 05-03-2012, 10:56 AM
  5. Replies: 3
    Last Post: 09-30-2011, 04:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1