Hi All,
I have a member of this forum for a while and have sat on the fringes and "watched" so to speak. I now have a query that I would like some assistance with though;
I have the following VBA code from one that was published here;
Sub MergeSheets()
' Appends data from all the selected worksheets onto the end of the
' active worksheet.
Const NHR = 1 'Number of header rows to not copy from each MWS
Dim MWS As Worksheet 'Worksheet to be merged (appended)
Dim AWS As Worksheet 'Worksheet to which the data are transferred
Dim FAR As Long 'First available row on AWS
Dim LR As Long 'Last row on the MWS sheets
Dim MWSR As Range 'Range to copy from MWS to AWS
Set AWS = ActiveSheet
For Each MWS In ActiveWindow.SelectedSheets
If Not MWS Is AWS Then
FAR = AWS.UsedRange.Cells(AWS.UsedRange.Cells.Count).row + 1
LR = MWS.UsedRange.Cells(MWS.UsedRange.Cells.Count).row
Set MWSR = MWS.Range(MWS.Rows(NHR + 1), MWS.Rows(LR))
'limit range to cells within the usedrange
Set MWSR = Application.Intersect(MWSR, MWS.UsedRange)
MWSR.Copy
AWS.Select 'Select AWS to cause de-select of MWS before paste
'Range(Rows(FAR), Rows(FAR + LR)).Select
Range(Cells(FAR, 1), Cells(FAR + MWSR.Rows.Count - 1, MWSR.Columns.Count)).Select
ActiveSheet.PasteSpecial , True
End If
Next MWS
End Sub
This is great but I am now handing the project over and would like to simplify the process. At present I have to highlight all the relevant sheets (all but 5)and then run the macro, then convert the consolidated data into a table.
I would like to use a simple button that the new users can use to run this process. Does anyone have any suggestions at to how I might do this?
Thanks for taking the time.
Bookmarks