+ Reply to Thread
Results 1 to 6 of 6

Redimensioning/Resetting a variant array for a new loop iteration

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Austin, TX, USA
    MS-Off Ver
    Office 2013 and 2016
    Posts
    9

    Redimensioning/Resetting a variant array for a new loop iteration

    Hi folks,

    I have an add-in where I import a series of fixed-width text files do some processing of the imported data and then append the newly imported data to a workbook containing data imported from other imported text files.

    More precisely,

    I use a Workbooks.OpenText method to import a text file containing fixed-width data (The number of rows imported from each file can vary).
    I then modify some of the data.
    I then write the new data to a variant array called Transfer() using Transfer = TransRange.Value (without giving the array explicit dimensions)
    I then activate an aggregate workbook containing data from previous text files and add (append) the newly imported data to the bottom of the file using
    ReceiveRange = Transfer.

    At this point the loop goes back to the beginning and starts the process over with another fixed-width text file. How do I prepare the Transfer array to receive another set imported data
    in the next iteration? Do I need to? I could extract row and column information from the TransRange range each time, but I'd rather not if I can avoid it. Many thanks in advance for your help!!!

    Erik

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,070

    Re: Redimensioning/Resetting a variant array for a new loop iteration

    How about
    Please Login or Register  to view this content.

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Redimensioning/Resetting a variant array for a new loop iteration

    You shouldn't need to do anything. Each assignment will resize and replace the previous one.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Registered User
    Join Date
    06-20-2014
    Location
    Austin, TX, USA
    MS-Off Ver
    Office 2013 and 2016
    Posts
    9

    Re: Redimensioning/Resetting a variant array for a new loop iteration

    Thanks very much!!!!

  5. #5
    Registered User
    Join Date
    06-20-2014
    Location
    Austin, TX, USA
    MS-Off Ver
    Office 2013 and 2016
    Posts
    9

    Re: Redimensioning/Resetting a variant array for a new loop iteration

    Thanks very much!!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,070

    Re: Redimensioning/Resetting a variant array for a new loop iteration

    Glad we could help & thanks for the feedback

+ 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. [SOLVED] A variable defined as variant or variant array
    By billj in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-14-2016, 05:35 PM
  2. [SOLVED] Go to next loop iteration if current loop has error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-03-2016, 09:54 PM
  3. VBA - How to continue inner loop while going to next iteration of outer loop?
    By alviniac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2015, 11:21 PM
  4. Does setting a variant acting as an array equal to "" accomplish same as "Erase" variant?
    By dmasters4919 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 05:59 PM
  5. Resetting array values to zero using variant
    By gameybeets in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-22-2014, 12:17 PM
  6. Loop Array Iteration and Processing
    By Bigced_21 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2010, 11:16 AM
  7. Subscript out range error when redimensioning dynamic array
    By Crazy Cat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2006, 02:30 AM

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