+ Reply to Thread
Results 1 to 6 of 6

Subscript out of range error while populating array from range.

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    47

    Subscript out of range error while populating array from range.

    hi i was wondering if anyone could tell me why im getting a "Subscript Out of Range" error on this code??

    Please Login or Register  to view this content.
    this code is located in the Worksheet OnChange function of Sheet 2 "Corro"

    "discSelection" is sheet 16

    any help would be much appreciated
    Last edited by Aussiexile; 11-04-2010 at 02:23 AM. Reason: Solved

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Subscript out of range error while populating array from range.

    What does discArray(0) equal?

    Arrays are always zero based.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    09-23-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: Subscript out of range error while populating array from range.

    sorry i forgot i changed the range the range is actuallt A1:A31 and contains this list

    1 - Client
    A - Accounting & Finance
    B - Procurement
    C - Project Controls
    D - Community Relations
    EA - Architectural
    EC - Civil
    EE - Electrical
    EG - Engineering Management
    EH - Environmental
    EJ - Control Systems
    EK - Geotech & Hydraulic Engineering Services
    EM - Mechanical
    EN - Materials Engineering Technology)
    EP - Plant Design & Piping
    ER - Pipeline & Marine
    ES - Structural
    EU - Loss Prevention
    EV - Process
    EZ - Project Engineering
    F - Project Management
    H - Safety & Health
    K - Administration
    M - Management
    P - Information Systems & Technology
    PR - Public Relations
    Q - Quality Assurance
    S - Safety
    TF - Construction
    U - Startup
    V - Contracts

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Subscript out of range error while populating array from range.

    DiscArray is a 2 dimensional array, 2 rows X 1 column.

    Try
    Please Login or Register  to view this content.
    Or without looping

    Please Login or Register  to view this content.
    Last edited by mikerickson; 11-04-2010 at 02:27 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Subscript out of range error while populating array from range.

    Hi,

    Here is how you need to do it at: http://support.microsoft.com/kb/213798
    The second example down.

  6. #6
    Registered User
    Join Date
    09-23-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: Subscript out of range error while populating array from range.

    Your both brilliant.

    Thank you both for you help it is very much appreciated

+ 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