Input Boxes 4 Inserting A Range In A Formula
Good point about stacking up range names.
This seems to test out OK.
Sub InsertFormula()
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Application.InputBox(prompt:="Select rng1", Type:=8)
Set rng2 = Application.InputBox(prompt:="Select rng2", Type:=8)
ActiveCell.Formula = "=SUMPRODUCT(--(" _
& rng1.Address & "<0)," & rng2.Address & ")"
End Sub
Gord
On Sat, 1 Mar 2008 13:10:00 -0800, FARAZ QURESHI
wrote:
Thanx 4 the reply after all Gord!
However, isn't it possible to have the ranges themselves being inserted
instead of defining and adding and using the names?
Otherwise while re-running the macro for another data within the same book
shall have the names rng1 & rng2 be redefined leading to an error in the
first formula!
Besides the same if u go on inserting new names it shall be quite a
troublesome task finding the definition of each 1!
Please help me out!!!
|