Consulting

Results 1 to 3 of 3

Thread: Extract single row from multiple workbooks

  1. #1
    VBAX Newbie
    Joined
    Jan 2018
    Posts
    2
    Location

    Extract single row from multiple workbooks

    Hey! Im in need of some VBA knowledge and would really appriciate some help!

    What Im trying to do is a sub program that fetches 7 .csv files and copies B:Y from every one of these 7 workbooks where A1 = "OP0165-IN" (variates from row 19-21, but is never more than 1 row). They all have 1 sheet but the sheet names variates wildely.

    I would like to add the data to my sheet "data" from A1 and onwards.

    I have some basic VBA knowledge, so I think Im on the correct path with something like this:


    Sub GetFile()Dim MySummary As Workbook
    Dim GetfilesfromMultiplebooks As Workbook
    Dim fd As FileDialog
    Dim oFD As Variant
    Dim fileName As String
    
    
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    
    
    With fd
            .ButtonName = "Select"
            .AllowMultiSelect = True
            .Filters.Add "Excel Files", "*.csv", 1
            .Title = "Select all 7 CSV files"
            .InitialView = msoFileDialogViewDetails
            .Show
            For Each oFD In .SelectedItems
                fileName = oFD
            Next oFD
            On Error GoTo 0
     End With
    
    
     If fd.SelectedItems.Count = 0 Then
    
    
     Exit Sub
    
     End If
    
    
     -For each code here?-
    
     End Sub
    I think this is one way of doing it. But I havnt really figured out how to extract the data (if I even have the data). Ive been reading examples with "for each workbook". But I couldnt get it to work properly.

    If you could help me with this I would be incredible grateful! Thank you very much!!

  2. #2
    Did you read the comments in the other forums where you posted the same question?
    It's all about cross posting and being polite.

  3. #3
    VBAX Newbie
    Joined
    Jan 2018
    Posts
    2
    Location
    Quote Originally Posted by jolivanes View Post
    Did you read the comments in the other forums where you posted the same question?
    It's all about cross posting and being polite.
    It wasn't my intention to be unpolite. If I found a solution I would have been sure to share it.
    If the comments you're refering to are the ones you have written. Yes I have seen them now.

    I am not allowed to post links in this forum:
    To be able to post links your post count must be 5 or greater. Your post count is 1 momentarily.

Posting Permissions

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