+ Reply to Thread
Results 1 to 11 of 11

Convert csv to xls with other actions

  1. #1
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Convert csv to xls with other actions

    Hi Again All

    I have searched the web and tried piecing together bits of code but can't seem to get this to work. I am tired but thats no excuse.

    What I need is a macro (VBA) to open a user selected csv delete row 2 and divide all cells containing a value in Cell range K2:AD50 by 100 then save as (current date).xls in folder C:\input\.


    Any body able to share a bit of code with me.

    Thanks in advance.

    Evan

  2. #2
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    Thanks for the quick reply

    We get updates for our bookings sent to us in csv format and I need to convert them to xls. They come with row 2 blank which i need to delete and I need to divide all cells values in K2:AD50 by 100 then save as current date xls.

    I need the operator to be able to select the csv file but it can be saved to c:\input.

    Hope this is understandable.

    Evan

  3. #3
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    Sorry here are the sample files.
    Added txt to csv to upload.

    Evan
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    Did you see my samples.

    Evan

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert csv to xls with other actions

    see attachment, run macro "txt"

    folder c:\input\" should exist for it to operate
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    I Tried this but had problem with file name searched web and found a change which worked and saved with date in format dd-mm-yy.xls

    But when I tried to open the xls file it said the format was wrong and it concactenated all cell values in rows to one cell.

    Any ideas

    The change I made is as follows.

    With ActiveWorkbook: .SaveAs Filename:="C:\input\" & Format(Now(), "dd-mm-yy") & ".xls": End With

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert csv to xls with other actions

    please try now
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    Thank You

    Works Fine

    Evan

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert csv to xls with other actions

    if you are satisified with the outcome please mark the thread as solved

  10. #10
    Registered User
    Join Date
    10-24-2009
    Location
    Southampton, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Convert csv to xls with other actions

    Dear Watersev

    I finally, after illness, got around to trying your macro on received data.

    It seems to reformat the date field to some uk format and some us format which corupts the end result.

    Any ideas.

    Evan

  11. #11
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert csv to xls with other actions

    check attachment, on the csv file attached works as required
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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