Hi Team,
Can we modify this macro which I get using this forum to combine specific data sheets only other than all data sheet in worksheet
Sub integratie_Oeldere()
Dim wsTest As Worksheet
'check if sheet "ouput" already exist
Const strSheetName As String = "Consolidated"
Set wsTest = Nothing
On Error Resume Next
Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
On Error GoTo 0
If wsTest Is Nothing Then
Worksheets.Add.Name = strSheetName
End If
With Sheets("Consolidated")
.UsedRange.ClearContents
.Range("A1:E1").Value = Array("sheet", "Task", "Type", "Key Patient", "Key Doctor")
For Each sh In Sheets
With sh
If .Name <> "Consolidated" Then
Rng = .Cells(Rows.Count, 1).End(xlUp).Row - 1
If Rng > 0 Then
Sheets("Consolidated").Cells(Rows.Count, 1).End(xlUp)(2).Resize(Rng) = .Name
Sheets("Consolidated").Cells(Rows.Count, 2).End(xlUp)(2).Resize(Rng, 4) = .Range("A2").Resize(Rng, 4).Value
End If
End If
End With
Next
.Columns("A:Z").EntireColumn.AutoFit
End With
End Sub
I got this macro from
http://www.excelforum.com/excel-prog...68#post3286568
Bookmarks