using VBA to execute VBA formulas entered in cells...
hi all...was wondering if this could be done without using Application.VBE to write a sub...
Code:
Sub ExecuteUserFormulas()
Dim theFormula As String
theFormula = Range("D3").Value
'lets say D3 had [ ActiveCell.Address ] entered in it to keep it simple..
'...and the activecell was A1
Range("C3").Value = [the result of --- theFormula]
'Range("C3").Value should = $A$1
End Sub
'Why am i doing this?
...i need to loop through any amount of formulas thet may be
entered in various cells and list the results in the adjacent cells
like an example project....
I have done it using Application.VBE to write a sub and then running it
( takes 2 keypresses) but was wondering if a simpler way existed.....thanks...
Code:
With Application.VBE.ActiveVBProject.VBComponents("Module1").CodeModule
.DeleteLines 1, 3
.InsertLines 1, "Sub test"
.InsertLines 2, "msgbox ""Hello All"""
.InsertLines 3, "End Sub"
End With
thanks