xlhelp15
Board Regular
- Joined
- Sep 12, 2014
- Messages
- 115
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
Hi Everyone, Would need assistance on pasting selected columns value to combined tab. The below one is pasting values vertically where i would need it for every End of Row.
ID, Analyst & Column headers are unique fields in all the tabs which i have.
kindly assist.
ID, Analyst & Column headers are unique fields in all the tabs which i have.
kindly assist.
VBA Code:
Sub CombineMySheets()
Dim J As Integer
Dim Rng As Long
Dim vHeader As Variant, rngFound As Range, i As Long
On Error Resume Next
Application.Calculation = xlCalculationManual
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
For J = 2 To Sheets.Count
Sheets(J).Activate
For Each vHeader In Array("ID", "Analyst", "Comment")
Set rngFound = Sheets(J).Cells.Find(vHeader, , xlValues, xlWhole, 1, 1, 0)
i = i + 1
If Not rngFound Is Nothing Then
Range(rngFound, rngFound.End(xlDown)).Copy Destination:=Sheets(1).Cells(i, 1)
End If
Next
Next
Sheets("Combined").Activate
Columns.AutoFit
Application.Calculation = xlCalculationAutomatic
End Sub
VBA Code: