Home

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

%3CLINGO-SUB%20id%3D%22lingo-sub-340079%22%20slang%3D%22en-US%22%3EInput%20the%20same%20formula%20in%20excel%20across%20multiple%20worksheets%20to%20follow%20a%20sequence%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-340079%22%20slang%3D%22en-US%22%3E%3CP%3EI%20could%20not%20follow%20the%20macro%20written%20as%20my%20worksheets%20are%20named%20differently%20..%20e.g.%2012.001%2C%2012.002%2C%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20the%20formula%20i%20used%20is%20e.g%20%3DHeader!A2%20..%20pls%20help%20to%20inform%20how%20to%20change%20this%20macro%20which%20I%20found%20on%20a%20website%20..esp.%20Line%204%20%26amp%3B%205%20%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ESub%20EnterFormulas()%0A%0A%20%20%20%20Dim%20ws%20As%20Worksheet%0A%20%20%20%20For%20Each%20ws%20In%20Sheets%0A%20%20%20%20%20%20%20%20If%20InStr(1%2C%20ws.Name%2C%20%22Delivery%22%2C%20vbTextCompare)%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20ws.Range(%22A1%22).Formula%20%3D%20%22%3D'Booking%20Sheet'!F%22%20%26amp%3B%20Split(ws.Name%2C%20Chr(32))(1)%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20Next%0A%0AEnd%20Sub%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-340079%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormula%20or%20macro.%20Sure%20would%20be%20useful.%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Philvern
Occasional Visitor

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

 

Related Conversations