Results 1 to 10 of 22

Thread: Importing a csv File to a range

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by SDruley View Post
    Code:
    Sub PortToStage()
    Dim PicassoPage As Range
    Set PicassoPage = Application.Range("BANKA")
    Dim X As Long, FF As Long, S() As String
    ReDim S(1 To PicassoPage.Rows.Count)
    For X = 1 To PicassoPage.Rows.Count
    S(X) = Join(WorksheetFunction.Transpose(WorksheetFunction. _
    Transpose(PicassoPage.Rows(X).Value)), ",")
    Next
    FF = FreeFile
    Open "c:\TTND\PicassoPg.cvs" For Output As #FF
    Print #FF, Join(S, vbNewLine)
    Close #FF
    End Sub
    Rick Rothstein back in 2009 was responsible for creating the above code. I have modified it to include my specific range name, "PicassoPage" where previously it indicated "Selection".
    I hope I don't get into trouble on my first post on this site but I have seen Rick's work and it is my opinion he is the best programmer in the country.

    So, I am looking for help in creating code to take the above generated file (PicassoPg.cvs) created using Workbook A and pull it into a range with the same name and configuration in Workbook B, sort of like a parallel universe thing. Both workbooks have easy access to the csv file and when you look at the corresponding worksheets in both workbooks they look identical. The only difference is that the range name in workbook B is "BankB"
    First, I must tell you that I am flattered beyond words at your generous comments about my programming abilities. Truth be told, I personally think you have greatly over-estimated my programming skills; but, that notwithstanding, I thank you profusely for your comments!

    Second, change the file extension from the "cvs" you show to "csv" which is the proper extension for a comma-separated-values file. Once you have done that, you can simply open the file directly into your new workbook... no VBA code needed... and the file will look just like the original it was created from. When you open it, make sure to select "Text Files (*.prn; *.txt; *.csv)" in the "Files of type:" drop-down.




    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 06-10-2023 at 04:15 PM.

Similar Threads

  1. Macro To Close All CSV Files
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 03-15-2014, 05:24 PM
  2. Save Excel 2010 File In CSV Format VBA
    By mag in forum Excel Help
    Replies: 7
    Last Post: 01-08-2013, 07:16 PM
  3. Macro to export sheet as CSV
    By Howardc in forum Excel Help
    Replies: 2
    Last Post: 07-25-2012, 08:59 PM
  4. Replies: 1
    Last Post: 06-02-2011, 10:38 AM
  5. Save File In CSV Format VBA
    By Raj Kumar in forum Excel Help
    Replies: 3
    Last Post: 06-01-2011, 07:22 AM

Posting Permissions

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