Hi
i have macro that Headers wise paste data of all sheets please tell me all workbook how to pull data in to this macro
i have macro that Headers wise paste data of all sheets please tell me all workbook how to pull data in to this macro
Code:
Option Explicit
Sub CopyData()
Dim i As Integer, lastRow As Long
Dim PstRng As Range
Dim ws As Worksheet
Dim lrow As Long
Dim sht3 As Worksheet
Set sht3 = Worksheets("Macro Data")
sht3.[2:65536].EntireRow.Delete
For Each ws In Worksheets
If ws.Name <> "Macro Data" Then
ws.Select
lastRow = Range("A" & Rows.Count).End(xlUp).Row
lrow = sht3.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To 15
Set PstRng = sht3.Range("1:1").Find(Cells(1, i).Value, [A1], xlValues, xlWhole)
If Not PstRng Is Nothing Then
Range(Cells(2, i), Cells(lastRow, i)).Copy PstRng.Offset(lrow, 0)
End If
Next i
End If
Next ws
MsgBox "Done"
End Sub