+ Reply to Thread
Results 1 to 4 of 4

Wrong number of Arguments error on macro - help!

  1. #1
    Registered User
    Join Date
    01-19-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    4

    Wrong number of Arguments error on macro - help!

    I had a macro that copied a range of 2 columns and 31 rows from every worksheet in my workbook and pasted them on one worksheet. I tried to revise it to copy more columns on each worksheet but I get the error: "Wrong number of arguments or invalid property assignment." Below is my macro. Can anyone help me fix the error? (The debugger highlights ".Range") Of course, I need it fast. Thank you!

    Sub CopyAllSheets()

    Dim ws As Worksheet

    Application.ScreenUpdating = False

    For Each ws In Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"))
    With ws
    .Range("A2:A31", "B2:B31", "C2:C31", "D2:D31", "E2:E31", "F2:F31", "G2:G31", "H2:H31").Copy
    Worksheets("Printout").Range("A" & Cells(Rows.Count, 1).End(xlUp).Row + 1).PasteSpecial (xlPasteValues)
    End With
    Next ws

    Application.CutCopyMode = False
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Wrong number of Arguments error on macro - help!

    Please Login or Register  to view this content.
    Next time please surround your code in code tags (highlignt and click the # symbol in the menu above)
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    01-19-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Wrong number of Arguments error on macro - help!

    Thank you so much, Arkadi. It worked! I will use the correct format next time...Apologies!

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Wrong number of Arguments error on macro - help!

    No worries and you are welcome!

+ 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] Excel VBA Compile Error wrong number of arguments
    By gjwilson1216 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-24-2013, 03:08 PM
  2. [SOLVED] VBA - Compile Error - Wrong number of arguments
    By Janto724 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-28-2013, 06:04 AM
  3. Compile Error - Wrong number of arguments
    By freebird_wr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2013, 09:34 AM
  4. wrong number of arguments invalid or property assignment error
    By uduyt in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2012, 08:39 AM
  5. Replies: 1
    Last Post: 02-17-2006, 12:10 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