Input the same formula in excel across multiple worksheets to follow a sequence

Copper Contributor

I could not follow the macro written as my worksheets are named differently .. e.g. 12.001, 12.002, 

and the formula i used is e.g =Header!A2 .. pls help to inform how to change this macro which I found on a website ..esp. Line 4 & 5 ? 

 

Sub EnterFormulas()

    Dim ws As Worksheet
    For Each ws In Sheets
        If InStr(1, ws.Name, "Delivery", vbTextCompare) Then
            ws.Range("A1").Formula = "='Booking Sheet'!F" & Split(ws.Name, Chr(32))(1)
        End If
    Next

End Sub

 

0 Replies