+ Reply to Thread
Results 1 to 4 of 4

Help with Compile Error: Expected Array

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Help with Compile Error: Expected Array

    I am trying to write some code that will create new worksheets based on the selection of certain controls on a userform, run some code on those newly created sheets and then print them. I have accomplished the first two goals. I am now on to printing. I want to print the newly created sheets at one time by adding them to an array first. There in lies my hangup. This is the first time I have ventured into using arrays.

    I have the following code but keep getting an error that says "Compile Error: Expected Array":

    Please Login or Register  to view this content.
    The debugger only highlights
    Please Login or Register  to view this content.
    , not the nWs if that helps.

    I thought the ReDim command creates the array so I'm a little baffled as to why there isn't an array where one is expected. Again, arrays are new to me.

    I appreciate any help.

    Thank you.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with Compile Error: Expected Array

    No ReDim Re-Dimensions an existing dynamic array. So you need to have one to start with, change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Help with Compile Error: Expected Array

    Kyle123,

    I have to admit, I read your reply 5 times and was getting ready to post a reply that your code was the same as mine when I took one last look and noticed the parentheses.

    I love when the solution is so easy.

    Thank you.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Help with Compile Error: Expected Array

    glad it helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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