Not without setting some sort of "flag" or indicator to say the code has
been run already.
You can do this in a number of ways.... But... You can also set up the code
in the auto_open procedure. This is run when the workbook is opened.
Option explicit
Sub Auto_Open
mln
End sub
Sub mln()
Dim llAnswer as long
Dim lsMsg as string
Dim lsTitle as string
Dim rlCell as Range
lsMsg = "Please note that this will replace formulae with value."
lsMSg = lsMsg & vbCrLf
lsMSg = lsMsg & "So you are requested to run this on a copy of the file."
lsTitle = "Important"
llAnswer = MsgBox(lsMsg, vbYesNo + vbExclamation, lsTitle)
If llAnswer = vbYes Then
For Each rlCell In Selection
rlCell.Value = Application.WorksheetFunction.Round(c / 1000000, 2)
Next rlCell
End If
End Sub
Note too that I've "tidied" the code up a bit.
1) Put Option Explicit at the top.
This makes sure that code running undeclared variables will error.
2) Made more meaningful names of the variables.
3) Added Dim for the c / rlCell variable.
4) Added variables for the text strings.
This makes the msgbox code more "generic".
5) Structured the code to make it more readable.