+ Reply to Thread
Results 1 to 5 of 5

Open multiple workbooks by referencing cells down a column

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Open multiple workbooks by referencing cells down a column

    The following code is supposed to open multiple books down a list in column B but only the first workbook listed opens




    Sub OPENBOOK()
    On Error Resume Next

    Application.DisplayAlerts = True
    Dim i As Byte

    With Sheets("TOTE")

    For i = 15 To 25
    If Err.Number Then
    GoTo NextFOR
    Err.Clear
    End If
    If UCase(.Cells(i, "A").Value) = True And Cells(i, "B").Value <> "" Then
    Application.Workbooks.Open ("C:\Documents and Settings\" & Cells(i, "B").Value)

    End If

    NextFOR:
    Next i
    End With

    End Sub

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this :

    Sub OPENBOOK()
        Dim R As Byte
    
        Application.DisplayAlerts = True
    
        With Worksheets("TOTE")
            For R = 15 To 25
                If UCase(.Cells(R, 1).Value) = True And .Cells(R, 2).Value > "" Then
                    FILE$ = "C:\Documents and Settings\" & .Cells(R, 2).Value
                    If Dir(FILE) > "" Then Application.Workbooks.Open FILE
                End If
            Next R
        End With
    End Sub
    Last edited by Marc L; 12-17-2013 at 11:06 PM.

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Try this :

    same result, only opens one file

  4. #4
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Try this :

    I think the macro ends after first workbook opens and does not loop

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Open multiple workbooks by referencing cells down a column


    My code, without any trap error, opens only existing file after this condition :

    If UCase(.Cells(R, 1).Value) = True And .Cells(R, 2).Value > ""

    Maybe this is the issue …

    (Forum rules : use code tags around code, edit your fisrt post …)
    Last edited by Marc L; 12-17-2013 at 11:40 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 12-15-2013, 05:15 PM
  2. Referencing data in multiple workbooks
    By shism001 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-23-2013, 08:22 AM
  3. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM
  4. Macro to referencing the same cells in multiple workbooks (200+)
    By MP1402 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2009, 04:30 AM
  5. Referencing Multiple Workbooks
    By plmitche in forum Excel General
    Replies: 2
    Last Post: 09-13-2007, 03:15 PM

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