Good Evening,
I am currently using a spreadsheet that I did not write the vba code for a certain function, but hoping someone might be able to rtell me if the possibility exists to have it function slightly different.
I have a tab in the workbook that there is a current macro that will retrieve the information from a different spreadsheet (selected by the user) and copy data from a named range of cells, then paste it into the current spreadsheet.
I am wondering if there is a way to select multiple spreadsheets so the operation can happen all at once?
The information from the "Retrieved from" sheets will always reside in the same sub folder.
The user selects the file to import data from, I am hoping that there is a way to allow for the selection of multiple files in order to save time. There are instances where the user needs to import 30 or more sets of data and this would cut down on the time to complete the task. Obviously I would want the information to come in from each spreadsheet and populate in there each rows. This might not even be possible, but hoping someone might be able to assist me with this.
I am currently using a spreadsheet that I did not write the vba code for a certain function, but hoping someone might be able to rtell me if the possibility exists to have it function slightly different.
I have a tab in the workbook that there is a current macro that will retrieve the information from a different spreadsheet (selected by the user) and copy data from a named range of cells, then paste it into the current spreadsheet.
I am wondering if there is a way to select multiple spreadsheets so the operation can happen all at once?
The information from the "Retrieved from" sheets will always reside in the same sub folder.
VBA Code:
Public Sub LinkComposite()
Dim wbSource As Workbook, wsSource As Worksheet, wsComposite As Worksheet
Dim sSource As String, sComposite As String, iDataRow As Long, rFound As Range
sComposite = ActiveWorkbook.Name
If ActiveCell.Column <> 1 Then
MsgBox "Please ensure the selected cell is after the header row and in column A", , "Incorrect Cell Selected"
Exit Sub
End If
Set rFound = ThisWorkbook.Worksheets("Tooling").Range("B:B").Find("FREEFORM / SWAG", LookIn:=xlValues)
If ActiveCell.Row > 2 And ActiveCell.Row < rFound.Row Then
iDataRow = ActiveCell.Row
Else
MsgBox "Please ensure the selected cell is between the header row and the FREEFORM / SWAG Row" _
& " and in column A", , "Incorrect Cell Selected"
Exit Sub
End If
Application.Dialogs(xlDialogOpen).Show (ActiveWorkbook.Path)
sSource = ActiveWorkbook.Name
Set wbSource = Workbooks(sSource)
Set wsSource = wbSource.Worksheets("Summary")
Set wsComposite = ThisWorkbook.Worksheets("Tooling")
With wsComposite
wsSource.Range("Accounting_Info").Copy
.Range("A" & iDataRow & ":M" & iDataRow).PasteSpecial xlPasteValues
End With
Windows(sComposite).Activate
wbSource.Close SaveChanges:=False
Range("A2").Select
End Sub
The user selects the file to import data from, I am hoping that there is a way to allow for the selection of multiple files in order to save time. There are instances where the user needs to import 30 or more sets of data and this would cut down on the time to complete the task. Obviously I would want the information to come in from each spreadsheet and populate in there each rows. This might not even be possible, but hoping someone might be able to assist me with this.