Sub FormulaCopy()
'MyName is the name of the range to which data is to be copied _
it does not include the heading.
'The formulae are 2 rows above the heading i.e.
' Formula
' [blank]
' Heading
' first cell of range named ....
' Macro created 17/05/2005 by gk
'
Dim Myprompt As String, Response As String, Style As Integer
Myprompt = "For each cell in current selection the macro copies formulae in the second row above the selected cell to all cells below the selected cell. (actually there must be a named range equal to the text in the selected cell and it is this range that is copied to. Calculation may be set to manual as the routine calculates the pasted cells (only) and then pastes them to values"
Style = vbOKCancel + vbCritical + vbDefaultButton2 ' Define buttons.
Response = MsgBox(Myprompt, Style, "Copy Formulae Macro")
If Response = vbCancel Then Exit Sub
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For Each c In Selection
Application.StatusBar = "Applying Formulae to " + c.Value
With Range(Replace(c.Value, " ", "_"))
.Cells(-2, 1).Copy
.Cells.PasteSpecial (xlPasteAll)
.Calculate
.Cells.Copy
.Cells.PasteSpecial (xlPasteValues)
End With
Next c
Myprompt = "Macro Finished - calculation set to automatic"
Style = vbOK + vbCritical + vbDefaultButton2 ' Define buttons.
Response = MsgBox(Myprompt, Style, "Copy Formulae Macro")
If Response = vbCancel Then Exit Sub
Application.StatusBar = "Setting calculation to automatic"
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.StatusBar = ""
End Sub