MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Sub Append() Dim strFileSelected As String Dim objOfficeDialog As Object Dim wbDestination As Workbook Dim wbSource As Workbook Dim sh As Worksheet Application.DisplayAlerts = False Application.EnableEvents = False Application.ScreenUpdating = False Set objOfficeDialog = Application.FileDialog(msoFileDialogFilePicker) Set wbDestination = ActiveWorkbook With objOfficeDialog .Title = "Select the Project Cost Allocation file" .AllowMultiSelect = False If .Show <> -1 Then Exit Sub End If strFileSelected = .SelectedItems(1) End With Dim strSuffix As String If strFileSelected <> "" Then strSuffix = InputBox("Please enter text to append to tab names") Set wbSource = Workbooks.Open(strFileSelected) For Each sh In wbSource.Sheets sh.Copy After:=wbDestination.Worksheets(wbDestination.Worksheets.Count) wbDestination.Worksheets(wbDestination.Worksheets.Count).Name = sh.Name & " " & strSuffix Next sh wbSource.Close False End If Application.DisplayAlerts = True Application.EnableEvents = True Application.ScreenUpdating = True End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Excel vba question||7||39|
|Excel macro to autofill data in column based on adjoining column and continue for each value in column||3||27|
|What is wrong with this Excel formula with an IF statement?||6||34|
|Excel Data Validation Help||9||41|