+ Reply to Thread
Results 1 to 16 of 16

How to use array in worksheets()

  1. #1
    Registered User
    Join Date
    06-28-2018
    Location
    Czech Republic
    MS-Off Ver
    365
    Posts
    10

    How to use array in worksheets()

    Hello I'd like to copy from one worksheet to multiple but I don't know if it is possible to use array in worksheets().
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: How to use array in worksheets()

    As you have defined your array and its elements in the macro it's "read in" when you run your macro.

    As the array contains 18 elements a code for looping through sheets in a workbook and pasting the array values to each sheet could look like this:

    Please Login or Register  to view this content.
    Alf

  3. #3
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to use array in worksheets()

    Try this:
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    well I think this what you want

    Please Login or Register  to view this content.
    And in general to copy set of ranges
    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: How to use array in worksheets()

    As all others are the norm...Here's Old school
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,417

    Re: How to use array in worksheets()

    Another way to consider (assuming cell A1 on sheet "PoMil" contains the value to copy across)...
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    Quote Originally Posted by Rick Rothstein View Post
    Another way to consider (assuming cell A1 on sheet "PoMil" contains the value to copy across)...
    Please Login or Register  to view this content.
    It is not working on Excel2013!!!

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: How to use array in worksheets()

    @ Rick
    Actually forgot about that option...

    @ mohadin
    Does work...Remember
    assuming cell A1 on sheet "PoMil" contains the value to copy across

  9. #9
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    FillAcrossSheets method of sheets class failed

  10. #10
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,417

    Re: How to use array in worksheets()

    Quote Originally Posted by mohadin View Post
    It is not working on Excel2013!!!
    My latest version of Excel is 2010 and it works fine there. It is hard to believe that Microsoft removed this functionality, but I guess it is possible. Just out of curiosity, describe what does happen for you (and show any errors that you get)?

  11. #11
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    The Error in #9 Sir

  12. #12
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,417

    Re: How to use array in worksheets()

    Quote Originally Posted by mohadin View Post
    The Error in #9 Sir
    Error #9 is subscript out of range. The only thing I can think of for the code I posted is that one or more of the sheet names listed in the Array function call in my code does not match any sheet names in your workbook. Did you remember to change the OP's worksheet names (which is what I listed in the Array function call) to your own worksheet names?

  13. #13
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    This what I'm doing
    Attached Images Attached Images
    Attached Files Attached Files

  14. #14
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,417

    Re: How to use array in worksheets()

    Quote Originally Posted by mohadin View Post
    This what I'm doing
    You must include the sheet you activated as it is from that sheet that the copies will be made. So, just change this line of code in your macro...
    Please Login or Register  to view this content.
    to this...
    Please Login or Register  to view this content.
    and it should then work fine for you.

  15. #15
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How to use array in worksheets()

    Opps

    So it's my fault
    Thank you so much in Deed

  16. #16
    Registered User
    Join Date
    06-28-2018
    Location
    Czech Republic
    MS-Off Ver
    365
    Posts
    10

    Re: How to use array in worksheets()

    In the end i used.
    Please Login or Register  to view this content.
    Thank you all for help.

+ 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. Finding Array of Worksheets
    By Bill1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2019, 05:15 PM
  2. [SOLVED] Create array of worksheets by identifying first and last worksheets in array
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-05-2017, 03:08 PM
  3. [SOLVED] How to make an array of workbooks made up of an array of worksheets?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2012, 08:33 AM
  4. Save array of worksheets to csv
    By tonupgirl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2010, 06:00 AM
  5. Array of worksheets
    By nick carntowan in forum Excel General
    Replies: 4
    Last Post: 01-06-2009, 06:19 PM
  6. Two worksheets, one array
    By bob in forum Excel General
    Replies: 2
    Last Post: 06-14-2006, 06:30 PM
  7. Array to Worksheets
    By Paul W Smith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2006, 04:35 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