+ Reply to Thread
Results 1 to 5 of 5

Compile error about multiline initializtion of date array

  1. #1
    Registered User
    Join Date
    09-29-2024
    Location
    china
    MS-Off Ver
    2019
    Posts
    7

    Compile error about multiline initializtion of date array

    Hello, can anyone help me out? I want to init one big date array that could not use loop. And it has multilines. The compile failed.

    The code looks like below:

    Please Login or Register  to view this content.
    Thanks
    Craig
    Last edited by AliGW; 09-30-2024 at 12:40 AM. Reason: Code tags added - please review the forum guidelines.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,017

    Re: Compile error about multiline initializtion of date array

    #10/7/2024#, # _
    remove highlighted from all lines.

    But IMHO better to put the data in a sheet :easier to change than if in code.
    Last edited by JohnTopley; 09-30-2024 at 03:10 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,603

    Re: Compile error about multiline initializtion of date array


    But IMHO better to put the data in a sheet :easier to change than if in code.

    I couldn't agree more!

    It is hard enough trying to identify a wrongly-entered date on a worksheet (where dates can be entered in a single column and sorted etc.) but it is many times harder to identify such a date within several long lines of code.

    You don't need to use a loop to assign cell values to an array - you can assign values en bloc with a statement such as the following:
    Please Login or Register  to view this content.

    Regards,

    Greg M

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,210

    Re: Compile error about multiline initializtion of date array

    Quote Originally Posted by craigvan888 View Post
    ... I want to init one big date array ...
    The "Array" function has limitations, in this particular example there are too many lines for this function.

  5. #5
    Registered User
    Join Date
    09-29-2024
    Location
    china
    MS-Off Ver
    2019
    Posts
    7

    Re: Compile error about multiline initializtion of date array

    Thanks all!

+ 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] Compile error: Expected Array
    By Displace1535 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2024, 09:33 AM
  2. need help with error : compile error expected array
    By eggs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2017, 01:50 PM
  3. Replies: 0
    Last Post: 08-09-2017, 07:06 AM
  4. [SOLVED] Compile error: Expected Array
    By jkj115 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2016, 03:01 PM
  5. [SOLVED] Compile error: expected array
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-11-2015, 04:06 AM
  6. Compile Error: Expected Array
    By abfrempong in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-13-2012, 02:35 AM
  7. [SOLVED] formula array gives compile error
    By R..VENKATARAMAN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2006, 08:35 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