+ Reply to Thread
Results 1 to 10 of 10

How to add "" on every cell and saves as csv and open as txt file

  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    How to add "" on every cell and saves as csv and open as txt file

    Hi, I need help to add "" on every cell follow with a , for import files to Oracle. Had wrote a script from sample from internet but after adding these "" to the text in the cell, the formating of the 00 in the cell was gone.

    For example, the original data was 12345, I add 00 using custom to make it show as 0012345, but after running the macro to make the cell shows as "0012345", the result became "12345" without the 00 in front.

    1st requirement: to add "00" in front of column K,U and AI
    2nd requirement: column AB needs to add "0" in front of 1, to show as 01
    3rd requirement: column AE needs to show as 00
    4th requirement: column AF needs to show as 00000
    5th requirement: column AG needs to show as 0000
    6th requirement: column AH needs to show as 000
    7th requirement: column Y needs to show as blank when with " " with a spacing as blank
    FINAL and most important requirement, all cells after convert to txt file, needs to add "" for each data and separate with ,

    The result of the txt file should shows like this:

    "2022","OMS Invoices","01_OM_WARE_INV","LINE","ABC","WAREHOUSE STORAGE CHARGES","SGD","Sep Invoice","STANDARD GST","31-Aug-2018","0073096","H063","H063","101","1","248.4","248.4","User","1","NET 30","0073096","31-Aug-2018","310070-06","1", ,"REV","248.4","01","000","310001","00","00000","0000","000","0073096","310070-06","1","ABC","101"

    I had attached a sample excel file with the 3 macros and 1 txt file as the final desired result. Hoped someone can help.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    When you select save as a Text file you can choose the options and it automatically inserts " and delimiters of your choice.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: How to add "" on every cell and saves as csv and open as txt file

    Hi, Keebellah, sorry, I could not see this option, do you mind to show me?
    Last edited by AliGW; 10-20-2018 at 03:53 AM. Reason: Please do not quote the post immediately before yours - it is just clutter!

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    Even you select save as and then options ...

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    My mistake, It used to be possible in the older versions of Excel.
    I'll check your macro and see if I can help you with your problem.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    One thing you have to understand is the fact that a number format is to 'display' the way you look at the values.
    If you check your cells where you added the 00 if you look in the formula bar you will NOT see the 00 unless the cell is formatted as text
    Excel is not 'way you see is what you get'

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    This macro will do the job I have attached the result too


    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2007/2010/365
    Posts
    82

    Re: How to add "" on every cell and saves as csv and open as txt file

    Dear Keebellah,

    Really appreciate your respond but I could not make the macro work. I had attached the file where I had added your macro and would appreciate it if you could check why it cannot work.

    Actually I have no knowledge on how to write Visual Basic programming.

    Once again, I would like to say Thank you for your help.
    Attached Files Attached Files

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    Can you tell me what's wrong?
    The result file looks the same as the one I sent you earlier. Oracle(1).txt is the previous one
    Attached Files Attached Files

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: How to add "" on every cell and saves as csv and open as txt file

    If it's that you want to open the file as text file just add the code to open a text file
    Google "vba excel open text file in notepad" you'll get enough hits, and... if you ask for VBA then you should at least learn the basics, (free) tutorials enough on the web

+ 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. Replies: 7
    Last Post: 03-11-2017, 09:45 AM
  2. [SOLVED] msgbox: Show "Hi" when i open excel file based on cell value
    By ganeshkumar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2017, 11:17 AM
  3. """default folder in get open file"""
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2017, 09:40 AM
  4. Now always saves a "copy of" file out of no where
    By abcaulkoffice in forum Excel General
    Replies: 1
    Last Post: 10-17-2013, 03:45 PM
  5. VBA - IE - click on "Open" in an internet explorer "file download" window
    By victoire in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2013, 07:08 AM
  6. File saves "invoice" to document title. Trying to make it stop
    By Habanero Time in forum Excel General
    Replies: 0
    Last Post: 01-14-2013, 04:27 AM
  7. Transfert cell values from file "A" to file "B" skipping columns in file "B".
    By Sentrosi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2009, 11:11 PM

Tags for this Thread

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