Results 1 to 20 of 125

Thread: Combine recursive listing with excluded code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,899
    Location
    Yes, not sure about the "which dynamically shortens or lengthens" part

    Option Explicit
    
    Sub LoadArray()
        Dim a As Variant
        Dim B As Variant
        Dim i As Long
        
        'needed to make a 1 dim array
        a = Application.WorksheetFunction.Transpose(ActiveSheet.Cells(1, 1).CurrentRegion)
    
    
        'we can use this as a 2 dim array
        B = ActiveSheet.Cells(1, 3).CurrentRegion
        
        For i = LBound(a) + 1 To UBound(a)
            Call SubA(a(i))
        Next i
        
        For i = LBound(B, 1) + 1 To UBound(B, 1)
            Call SubB(B(i, 1), B(i, 2))
        Next i
        
    
    
    End Sub
    
    
    Sub SubA(N As Variant)
        MsgBox "SubA   " & 10 * N
    End Sub
    
    
    Sub SubB(N1 As Variant, N2 As Variant)
        MsgBox "SubB    " & N1 * N2
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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