Results 1 to 4 of 4

Range assigned to array

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Range assigned to array

    Dear Forum members
    Can any one explain why the following little Function does not work ?
    The attached workbook contains the named range.
    Sub Test()
    CylIMP = "10"""
    CylSize = MetSize(CylIMP)
    
    End Sub
    
    Function MetSize(CylIMP)
    
    
    Dim CylsAr(13, 1) As Variant
    
            CylsAr = Range("Cylinders").Value ' ***
      
    
    For a = 0 To 13
      
       
         If CylIMP = CylsAr(a, 0) Then
                CylSize = CylsAr(a, 1)
                Exit For
         End If
    Next a
    MetSize = CylSize
    End Function
    This gives an error message:- Compile error Can't assign to an array
    The highlight is on the assignment line marked with asterixes

    In hope
    John
    Attached Files Attached Files
    Last edited by j_Southern; 11-30-2011 at 10:35 AM.

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