Consulting

Results 1 to 9 of 9

Thread: Solved: Clearing Array contents

  1. #1

    Solved: Clearing Array contents

    mmmm, where to start!!

    I have an array that I wish to 'flush out' the values from after a specific action has taken place in order for it to be re-populated with fresh values.

    Any suggestions folks??
    Last edited by BexleyManor; 07-28-2004 at 04:22 AM. Reason: Better explination of problem, hopefully!!

  2. #2
    VBAX Mentor XL-Dennis's Avatar
    Joined
    May 2004
    Location
    ?stersund, Sweden
    Posts
    499
    Location
    Hi and welcome to VBAX

    As a start check out Erase in the directhelp.

    Kind regards,
    Dennis
    Kind regards,
    Dennis

    ExcelKB | .NET & Excel | 2nd edition PED


  3. #3
    Sorry, where do I find the directhelp section??

  4. #4
    VBAX Contributor Richie(UK)'s Avatar
    Joined
    May 2004
    Location
    UK
    Posts
    188
    Location
    Hi BM,

    How about using ReDim (without the Preserve option)?

    Like this:[vba]Sub Test()
    Dim lArray() As Long

    ReDim lArray(10) As Long
    lArray(0) = 123
    MsgBox lArray(0)

    ReDim lArray(10) As Long
    MsgBox lArray(0)

    End Sub[/vba]HTH

  5. #5
    VBAX Mentor XL-Dennis's Avatar
    Joined
    May 2004
    Location
    ?stersund, Sweden
    Posts
    499
    Location
    Hi,

    Write the word Erase in the VB-editor, highlight it and hit the F1-button.

    Kind regards,
    Dennis
    Kind regards,
    Dennis

    ExcelKB | .NET & Excel | 2nd edition PED


  6. #6
    Dennis, thanks for that great little tip, I'll be using that again for sure!!

  7. #7
    Thanks for the quick response Richie, I shall follow your advise..

  8. #8
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,938
    Location
    Hey there,

    Did this information help you solve this one BexleyManor?

  9. #9
    Yes indeed, it was in conjunction with my do Loop question and both were solved to perfection, All hail the VBA Express Gods !!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •