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
    Code fragment that may help


    Option Explicit
    
    
    Dim rowNext As Long
    Dim ws1 As Worksheet, ws2 As Worksheet
        
    
    
    Sub LoadArray()
        Dim aryFolders As Variant
        Dim aryParameters As Variant
        Dim i As Long
        
        Set ws1 = Worksheets("Sheet1")
        Set ws2 = Worksheets("Sheet2")
        
        'needed to make a 1 dim array
        aryFolders = Application.WorksheetFunction.Transpose(ws1.Cells(1, 1).CurrentRegion)
    
    
        'next blank row
        rowNext = ws2.Cells(ws2.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        
        For i = LBound(aryFolders) + 1 To UBound(aryFolders)
            Call ListInfo(aryFolders(i), i)
        Next i
        
    End Sub
    
    
    
    
    Sub ListInfo(S As Variant, N As Long)
    'Sub ListInfo(oFolderFile As Object, sType As String)
    '    With oFolderFile
    '        wsOut.Cells(rowOut, colPath).Value = RemovePrefix(.Path)
    '        wsOut.Cells(rowOut, colParent).Value = RemovePrefix(oFSO.GetParentFolderName(.Path))  'oFSO.GetParentFolderName(.Path) or .ParentFolder.Path
    '        wsOut.Cells(rowOut, colName).Value = .Name
    '         wsOut.Cells(rowOut, colFileFolder).Value = sType
    '        wsOut.Cells(rowOut, colCreated).Value = .DateCreated
    '        wsOut.Cells(rowOut, colModified).Value = .DateLastModified
    '        wsOut.Cells(rowOut, colSize).Value = .Size
    '        wsOut.Cells(rowOut, colType).Value = .Type
    '    End With
    
    
        With ws2.Rows(rowNext)
            .Cells(1).Value = S
            .Cells(2).Value = N
            .Cells(3).Value = 2 * N
            .Cells(4).Value = 4 * N
            .Cells(5).Value = N ^ 2
            .Cells(6).Value = N / 2
        End With
        
        rowNext = rowNext + 1
    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
  •