+ Reply to Thread
Results 1 to 13 of 13

Is it possible to use Application.Index to write 2 adjoining columns in one go?

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Like the thread title says. Say I want to write column 3 & 4 to a worksheet range. Is this possible? Or would I need to write column 3 and then column 4?
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Hello, a thread was put together a while back going over uses for Index and the above is covered in a latter section.

    http://www.excelforum.com/tips-and-t...2d-arrays.html

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Quote Originally Posted by DonkeyOte View Post
    Hello, a thread was put together a while back going over uses for Index and the above is covered in a latter section.

    http://www.excelforum.com/tips-and-t...2d-arrays.html
    Thank you. I skimmed through the thread but couldn't find what I was looking for. Which post # was it?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    It's a Tip thread so post #1 - in basic terms:

    Please Login or Register  to view this content.
    use of [ ] purely for shorthand example - not recommended

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Quote Originally Posted by DonkeyOte View Post
    It's a Tip thread so post #1 - in basic terms:

    Please Login or Register  to view this content.
    use of [ ] purely for shorthand example - not recommended
    I must be missing something.

    I am trying to paste columns 1 & 2 of an array to a worksheet range starting from cell A6 to B(length of array data). But when I end up with A6:B12 repeating the same data over and over....

    Extract below
    Please Login or Register  to view this content.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    you missed the Evaluate("ROW(1:" & UBound(av1, 1) & ")") part of the code ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    As above, the Evaluate element is required to build the Row Array - defaulting row index to 0 (by omission) will not work with this approach.

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Quote Originally Posted by DonkeyOte View Post
    As above, the Evaluate element is required to build the Row Array - defaulting row index to 0 (by omission) will not work with this approach.

    Please Login or Register  to view this content.
    It worked! Thank you! Thank you!

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Quote Originally Posted by JosephP View Post
    you missed the Evaluate("ROW(1:" & UBound(av1, 1) & ")") part of the code ;-)
    Well, not overlooked exactly. In my ignorance, I thought it wouldn't be necessary...

  10. #10
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    I don't suppose it would be possible to paste FOUR contiguous columns at once? (I tried with the code below but it didn't work. funny that )
    Please Login or Register  to view this content.

  11. #11
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    Quote Originally Posted by JosephP View Post
    Please Login or Register  to view this content.
    Slaps head. Hard.

    Of course. I forgot to resize.

    Thanks for that JosephP

  13. #13
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Is it possible to use Application.Index to write 2 adjoining columns in one go?

    you resized but not the right size :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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