Try this code - Each time any changes are done to the main page, you need to run the macro -
Option Explicit
Sub update_sheets()
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 <> "Equipment" Then
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
If lrow > 1 Then .Range("A2:M" & lrow).ClearContents
End If
End With
Next i
With Worksheets("Equipment")
lrow = .Range("L" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
sname = .Range("L" & 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 & ":M" & i).Copy Worksheets(sname).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Next i
End With
Application.ScreenUpdating = True
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Bookmarks