+ Reply to Thread
Results 1 to 7 of 7

Array does not store value

  1. #1
    Registered User
    Join Date
    02-04-2008
    Posts
    17

    Array does not store value

    Hi there,

    I have a small problem with my array dateSlot is not storing any values and I no idea why is that so. Its causing values to always be 0 in the array. Can anyone help me on this?

    Any help will be greatly appreciated. Thanks in advance!

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    Does changing

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    help?

    Rgds

  3. #3
    Registered User
    Join Date
    02-04-2008
    Posts
    17
    Thanks for such a quick reply. But the preserve doesn't help. Somehow this portion is the part that goes wrong.
    Please Login or Register  to view this content.
    The value i just wouldn't be stored in the array dateSlot and the if statement will never be caught somehow.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,
    Is the problem to do with the Base? Have you declared it as Base 1, or is the macro using the default of Base 0.

    If it is Base 0, then dateSlot(x) when x=1 is the second value in the array. I'm guessing here, but is an empty array position treated as zero or null. If null and zero are not equal then that may be the reason you never enter the IF.

    Just a thought. Let me know when you find the reason.

    Rgds

  5. #5
    Registered User
    Join Date
    02-04-2008
    Posts
    17
    I don't think it is a problem to do with base here. Also the I've tired the IF statement with a null too, it still didn't catch. I've got no clue how else to continue on this.

    Thanks for all the help so far.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    The values for dateSlot are initialized as 0.

    Thus, the conditional in this loop always returns False, leaving the values in dateSlot unchanged (i.e. 0)
    Please Login or Register  to view this content.
    What do you want the values for dateSlot to be?

    Can you describe in words what you want the routine to do?
    Last edited by mikerickson; 08-02-2008 at 12:18 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    02-04-2008
    Posts
    17
    My aim of that is to have the for the first empty slot in the dateSlot array, I'll insert the value of i in it. This is to store the many different column number.

    I realise my error already. I've actually made a careless mistake of making it not equals 0 when its suppose to be equals 0.

    Thanks for all your help on this.

+ 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