+ Reply to Thread
Results 1 to 8 of 8

VBA-array problem

  1. #1
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    VBA-array problem

    Please Login or Register  to view this content.
    I am going to loop some files for data copying. The above code is for copying the data into two arrays, Arr1 and Arr2.

    After I run the program, I find out that the data in the second file replaces the first file in the arrays, the third file replaces the second file,etc.....At last, I can only copy the data in the last file.

    What should i do??? Thanks

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA-array problem

    Example
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: VBA-array problem

    Quote Originally Posted by jindon View Post
    Example
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    I try your code, but it shows subscript out of range. Is there anything I miss???
    anyway, Thanks for your help!!!

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA-array problem

    I don't know what you are trying to do, but
    1) What is FXArr ?
    2) FNum in red is obviously out of range.
    Please Login or Register  to view this content.
    My guess
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: VBA-array problem

    Quote Originally Posted by jindon View Post
    I don't know what you are trying to do, but
    1) What is FXArr ?
    2) FNum in red is obviously out of range.
    Sorry i didnt mention my points clearly, but really thanks for your reply!!

    I want to copy data form a folder of excel files, then pasting those data into the excel file I assigned. The problem is that every time the program copies data from those files, it will replace the data from the last file. So, at last, it only shows the last file's data. I just want to know, how can I paste all data in the excel file? And what should i amend?

    I used this codes for copying and pasting:

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA-array problem

    How do you populate MyFiles?

  7. #7
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: VBA-array problem

    Quote Originally Posted by jindon View Post
    How do you populate MyFiles?
    This is all of the code


    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA-array problem

    I only needed to know...
    Please Login or Register  to view this content.
    try change to
    Please Login or Register  to view this content.

+ 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] I have a problem with my array
    By punter in forum Excel General
    Replies: 5
    Last Post: 08-30-2012, 09:13 AM
  2. [SOLVED] array problem
    By natanz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2006, 12:20 PM
  3. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2005, 01:54 AM
  4. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 12:30 AM
  5. Array Problem
    By gneville16 in forum Excel General
    Replies: 2
    Last Post: 02-24-2005, 11:17 AM

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