Hello Ricker090,
Sorry for the delay. I have rewrote the macro to be more flexible and faster. A button has been added to "Sheet1" to run the macro. Here is the revised macro code...
Sub MoveData_1()
Dim DataTitle As String
Dim DstWks As Worksheet
Dim Headers As Range
Dim NextRow As Range
Dim R As Long
Dim Rng As Range
Dim RngEnd As Range
Dim SrcWks As Worksheet
Set SrcWks = Worksheets("Master Data")
Set Headers = SrcWks.UsedRange.Rows(1)
Set Rng = Headers.Offset(1, 0)
Set RngEnd = SrcWks.Cells(Rows.Count, Rng.Column).End(xlUp)
Set Rng = SrcWks.Range(Rng, RngEnd)
Application.ScreenUpdating = False
For R = 1 To Rng.Rows.Count
DataTitle = Rng.Item(R, 1) & Rng.Item(R, 2) & Rng.Item(R, 3)
If DataTitle <> SrcWks.Name Then
On Error Resume Next
Set DstWks = Worksheets(DataTitle)
If Err <> 0 Then
Worksheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = DataTitle
Set DstWks = ActiveSheet
Err.Clear
End If
On Error GoTo 0
Set NextRow = DstWks.Cells(Rows.Count, "A").End(xlUp)
If NextRow.Row = 1 And NextRow = "" Then
Headers.Copy NextRow
End If
Set NextRow = NextRow.Offset(1, 0)
Rng.Rows(R).Copy NextRow
End If
Next R
Application.ScreenUpdating = True
End Sub
Bookmarks