Results 1 to 20 of 23

Thread: Anyone know how to - Range = typed array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    snb
    Guest
    @PH

    Nice !

    Since it's only about values I'd say:

    Sub Test() 
        Dim T As Product 
        Dim Arr(1 To 10) As Product 
        Dim sn 
        Dim i As Long 
         
        sn = ActiveSheet.Range("A1:E10") 
         
        For i = 1 To 10 
            With T 
                .Code = sn(i, 1) 
                .Description = sn(i, 2) 
                .Cost = sn(i, 3) 
                .Qty = sn(i, 4) 
                .Retail = sn(i,5) 
            End With 
             
            Arr(i) = T 
        Next I 
         
        MsgBox Arr(2).Code 
         
        MsgBox Arr(4).Description 
         
    End Sub
    Last edited by snb; 08-18-2014 at 01:23 PM.

Tags for this Thread

Posting Permissions

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