excel - Set a range and use that range in a formula -


i unable figure out how use set range in formula:

set range = application.inputbox(prompt:="test", title:="test", type:=8) sheets("sheet1").cells(3, 4).formula = "=sum(range)" 

all returned sum(range), not actual sum of selected cells.

i've tried range.address , couple other variations no avail.

your formula string, need concatenate range address formula:

sheets("sheet1").cells(3, 4).formula = "=sum(" & range.address & ")" 

you should use different name variable, however, range built-in type/function in excel vba.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -