Excel:如何用用户input修改的代码填充单元格?

我有这个IF声明:

=IF([Year]=2016,IF([Condition]="XClean",72,IF([Condition]="Clean",72,IF([Condition]="Average",72,IF([Condition]="Rough",72,0))))) 

我在一个单元格中embedded了这个IF语句55次,填满了11年的范围(从2016年到2005年)。 我使用公式分配多个任务。 我想知道是否有办法创build一个模块,在那里我可以input一个单元格坐标来replace[Year],input另一个单元格坐标来replace[Condition],以及一个我希望公式填充的单元格。

这是我坚持的地方:

 Sub MaxTerm() Dim year As Range '[Year]' Dim condition As Range '[Condition]' Dim origin As Range 'first cell of the column I want to populate' year = InputBox("what is the coordinate for model year?") condition = InputBox("what is the coordinate for the condition of the vehicle condition?") origin = InputBox("what is the origin?") 

援助非常感谢

获得一个范围

 Sub dural() Dim origin As Range Set origin = Application.InputBox(Prompt:="click on origin cell", Type:=8) End Sub 

注意我们使用Set
注意,我们可以使用鼠标或在字段中input地址。