+ Reply to Thread
Results 1 to 3 of 3

Help with pasting an array in a VB macro then copying down thousands of rows.

  1. #1
    Registered User
    Join Date
    06-12-2008
    Posts
    29

    Help with pasting an array in a VB macro then copying down thousands of rows.

    Hello all,
    I would like some help with a macro that I have, I was able to create this formula that I entered into a cell and got the results I wanted.
    =IFERROR(INDEX({"Machine 1","Machine 2","Machine 3"},MATCH(LEFT(A2,4),{"5000","5001","5002"},0)),"")

    excel.jpg

    When pasting this code into my macro I get the following error
    Compile error:
    Expected: expression

    Below is what my macro code looks like. Any help would be greatly appreciated. Thanks


    Range("O2").Select
    ActiveCell.FormulaR1C1 = _
    =IFERROR(INDEX({"Machine 1","Machine 2","Machine 3"},MATCH(LEFT(A2,4),{"5000","5001","5002"},0)),"")
    Selection.NumberFormat = "0"
    Range("O2").Select
    Selection.Copy
    Range("N3").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(0, 1).Range("A1").Select
    Range(Selection, Selection.End(xlUp)).Select
    ActiveSheet.Paste
    Range("A1").Select
    Application.CutCopyMode = False

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Help with pasting an array in a VB macro then copying down thousands of rows.

    Please wrap your code with code tags. You need to put any string including a null string inside ""
    Please Login or Register  to view this content.
    OR

    Please Login or Register  to view this content.
    Last edited by AB33; 08-04-2015 at 04:44 PM.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Help with pasting an array in a VB macro then copying down thousands of rows.

    Please use code tags => update your thread

    Then try

    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

+ 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. Copying & Pasting Values from Pivot Tables As Array
    By Mr Denove in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2013, 04:31 AM
  2. [SOLVED] Macro for copying only rows with values and pasting them at the end of another spreadsheet
    By rassiusluine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2013, 06:18 PM
  3. [SOLVED] Macro for copying values and pasting it for variable rows
    By Anonym216 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-24-2013, 04:43 AM
  4. Copying and pasting repeatly over 5000 rows (Macro).
    By GregOgie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2012, 06:57 PM
  5. Copying and pasting rows
    By Blaster in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2008, 05:57 PM
  6. copy and pasting thousands of cells.
    By Merickson04 in forum Excel General
    Replies: 3
    Last Post: 06-19-2008, 09:14 AM
  7. Copying and Pasting Array Data.. etc
    By amedhussaini in forum Excel General
    Replies: 1
    Last Post: 02-20-2008, 05:27 PM
  8. [SOLVED] Dynamic copying & pasting of rows
    By Chris Bromley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-08-2005, 12:06 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