+ Reply to Thread
Results 1 to 16 of 16

Using Array to Copy Columns

  1. #1
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Using Array to Copy Columns

    Greetings,
    I am trying to copy columns based on an Array. I have the following code (this is just the part of the code I am having issues with) and it is not working.
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    06-04-2019
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    48

    Re: Using Array to Copy Columns

    Mr. brentjohn,
    Good morning sir. Just a quick question for you. Is this code throwing an error, or is it just not working the way it was meant to work??

    Dome

  3. #3
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    BrokenDome,
    I am getting an error. "Range of object_Global failed.

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

    Re: Using Array to Copy Columns

    Are the values in AV12:AV14 the names of named ranges?
    Or range addresses?

  5. #5
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Fluff13,
    They are the names of the columns.

  6. #6
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Fluff13,
    For ex: cell AV12 (ms_Rest_Column) is the name range for column A.

  7. #7
    Registered User
    Join Date
    06-04-2019
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    48

    Re: Using Array to Copy Columns

    Mr. brentjohn,

    To copy over columns you can use something much simpler like the following:

    Please Login or Register  to view this content.
    This will copy the three columns into your second sheet. Hope this helps!!

    Dome
    Last edited by BrokenDome; 06-05-2019 at 10:46 AM. Reason: Change info

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

    Re: Using Array to Copy Columns

    Ok, how about
    Please Login or Register  to view this content.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Using Array to Copy Columns

    Do you actually have named ranges like 'ms_Rest_Column' or is that the column heading?
    If posting code please use code tags, see here.

  10. #10
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Norie,
    Yes, these are named ranges, not column headings.

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

    Re: Using Array to Copy Columns

    Have you tried what I suggested in post#8?

  12. #12
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Fluff,
    Sorry, I have been on conference calls and have not had an opportunity to incorporate your suggestion. I will shortly and let everyone know. Thank you for your help!!!

  13. #13
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Fluff,
    I am sorry for the late response, I have been on conference calls all day. Your code works great. However, I failed to state that within each of the columns are hidden rows. Your code actually copies the hidden rows and paste them.

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

    Re: Using Array to Copy Columns

    Ok, how about
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    510

    Re: Using Array to Copy Columns

    Fluff13,
    Works perfectly!!! Thank you much for your patience!

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

    Re: Using Array to Copy Columns

    You're welcome & 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] VBA copy value from array to another array - Type mismatch error
    By gargantuLars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2019, 01:13 PM
  2. [SOLVED] Noncontiguous columns to array -trying to correlate columns to array positions - and redim
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2019, 08:11 AM
  3. [SOLVED] VBA copy specified columns from one sheet to another using array
    By Tunesmith in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2019, 11:59 AM
  4. [SOLVED] Reorder array columns dimension by another array
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-16-2018, 12:53 AM
  5. [SOLVED] Quick Array question - Copy array to another array then resize?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-02-2013, 01:17 AM
  6. Array - Copy Formula, Paste as Array
    By lilanngel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2010, 08:20 AM
  7. select variables ranges, copy to array, paste the array in new workbook
    By Mathew in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2005, 05:06 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