Results 1 to 16 of 16

Save Txt file to a one dimensional array

Threaded View

  1. #6
    Registered User
    Join Date
    08-15-2008
    Location
    Mass
    MS-Off Ver
    2016, 64- Bit
    Posts
    36

    Re: Save Txt file to a one dimensional array

    Sub Test()
    
     Dim FSO As Object, MyFile As Object
     Dim FileName As String, Arr As Variant
    
     FileName = "Z:\xxxxxxx" ' change this to your text file full name
     Set FSO = CreateObject("Scripting.FileSystemObject")
     Set MyFile = FSO.OpenTextFile(FileName, 1)
     Arr = Split(MyFile.ReadAll, vbNewLine) ' Arr is zero-based array
    
    
     'For test
     'Fill column A from this Array Arr
    
     Range("A1").Resize(UBound(Arr) + 1, 1).Value = Application.Transpose(Arr)
    
    End Sub
    Last edited by AliGW; 05-21-2024 at 09:48 AM. Reason: Code tags added - please review the forum guidelines.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 01-24-2023, 05:21 PM
  2. [SOLVED] have 1 dimensional array, trying to create a 2 dimensional array, runtime 9
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2019, 07:03 AM
  3. [SOLVED] Convert 2 dimensional array to 1 dimensional
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2018, 05:20 AM
  4. Help converting one-dimensional array to multi-dimensional array
    By puzzlelover22 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2016, 06:48 AM
  5. save one dimensional array to a range
    By HenT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2016, 09:31 AM
  6. Parse Data from one dimensional array into a 2 dimensional array.
    By JapanDave in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-30-2016, 07:29 AM
  7. Creating a 2-dimensional array from a 1-dimensional list
    By guywithcamera in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2008, 06:34 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