Try this code
![]()
Sub copy_data() Dim i As Long, lrow As Long Dim sname As String Application.ScreenUpdating = False For i = 1 To Worksheets.Count With Worksheets(i) If .Name <> "Data entry" Then lrow = .Range("A" & .Rows.Count).End(xlUp).Row If lrow > 1 Then .Range("A2:G" & lrow).ClearContents End If End With Next i With Worksheets("Data entry") lrow = .Range("B" & .Rows.Count).End(xlUp).Row For i = 2 To lrow sname = .Range("C" & i).Value If Not Evaluate("ISREF('" & sname & "'!A1)") Then Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = sname .Rows("1:1").Copy Worksheets(sname).Range("A1") End If .Range("A" & i & ":G" & i).Copy Worksheets(sname).Range("A" & Rows.Count).End(xlUp).Offset(1, 0) Next i End With MsgBox "Data transferred" Application.ScreenUpdating = True End Sub
Bookmarks