+ Reply to Thread
Results 1 to 4 of 4

Setting an Array help?

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Setting an Array help?

    I have ten workbooks and I will be running the code below. Each workbook is assigned (a, b, c, d, e, F, g, h, i, j, k, l).

    How do I shorten this and make it run through this code without repeating the code like below?

    Please Login or Register  to view this content.

    Would it be something like?

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Setting an Array help?

    Hello taylorsm,

    You are close. The array values must be strings as they are workbook names.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Setting an Array help?

    Great. Just to be clear, so This
    Please Login or Register  to view this content.
    just becomes

    Please Login or Register  to view this content.

    Edit*

    I guess this is why we normally paste the whole code, but when I declare a workbook I do "Set j = Workbooks("John - October 2018.xlsm")" would I still need to add the "Workbooks(V)" or could I just do "V"?
    Last edited by taylorsm; 10-03-2018 at 05:42 PM.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Setting an Array help?

    Hello taylorsm,

    If you have assigned zRng to the range to be copied then your code will work.

    Another approach would be to use the Workbooks collection instead of an array...
    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. Setting values from array
    By AlexJr in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-24-2017, 06:14 AM
  2. Setting values from array
    By AlexJr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2017, 05:59 PM
  3. Setting/sorting an Array of Strings
    By ebase131 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 03:04 PM
  4. [SOLVED] Setting Array value to String which has a quote in it
    By jebrezov in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-29-2012, 03:30 PM
  5. VBA Setting Properties in an Array
    By Uziel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-29-2010, 03:03 PM
  6. Setting an array
    By richardlaw in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-27-2009, 05:24 PM
  7. Setting an array range of cells???
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2006, 10:30 PM

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