nsh.Cells(148, 5).Formula = Int(settings.Range("G" & i) * nsh.Cells(146, 5).Value)
the code give an hardcoded output, how to get the formula the in the cell.
nsh.Cells(148, 5).Formula = Int(settings.Range("G" & i) * nsh.Cells(146, 5).Value)
the code give an hardcoded output, how to get the formula the in the cell.
Hi Chirag and welcome to the Forum.
First, please edit your question title to something like "Applying a formula using VBA"- that would be far more helpful to others than the somewhat meaningless, generic "macro". Secondly, please delete the duplicate question with the title "macro" (if Don hasn't already).
You have to write the formula as a string, starting with "=" and building up the parts (as if you were writing it in a worksheet).
In your case the line should read:
nsh.Cells(148, 5).Formula = "=Int(" & settings.Name & "!G" & i & "*" & nsh.Cells(146, 5).Address & ")"
Hope this helps.