jcgroove
Technical User
- Oct 8, 2008
- 4
How can I use input box values in a formula that is put into a cell with VBA?
Example:
Sub comment_count()
Dim NUM1 As Variant
Dim NUM2 As Variant
NUM1 = InputBox("Enter the low range of comment numbers.", "ENTER")
NUM2 = InputBox("Enter the high range of coment numbers.", "ENTER")
Application.Worksheets("Install").Range("E17").FormulaArray = "=SUMPRODUCT(--ISNUMBER(MATCH(""*""&ROW(INDIRECT(""& NUM1:NUM2 &""))&""*"",$E$18:$E$2500&"""",0)))"
End Sub
Example:
Sub comment_count()
Dim NUM1 As Variant
Dim NUM2 As Variant
NUM1 = InputBox("Enter the low range of comment numbers.", "ENTER")
NUM2 = InputBox("Enter the high range of coment numbers.", "ENTER")
Application.Worksheets("Install").Range("E17").FormulaArray = "=SUMPRODUCT(--ISNUMBER(MATCH(""*""&ROW(INDIRECT(""& NUM1:NUM2 &""))&""*"",$E$18:$E$2500&"""",0)))"
End Sub