【发布时间】:2020-05-13 23:10:25
【问题描述】:
我正在尝试编写一个宏,它会将输入框默认值重新设置为最后输入的值,所以如果我在下面的输入框中键入“2”,默认值将更改为 2,下次宏已运行。
只有在我运行宏的工作簿关闭后,才能恢复原来的默认值
(Excel 2007)
ROWSDOWN = InputBox("enter no.of rows DOWN to move the cells", "VerticalMove", _
-1) 'default -1 (=1 row up)
我已尝试设置PREV_ROWSDOWN = ROWSDOWN,但我的尝试(如下)不起作用:下次我运行宏时,输入框默认值为 0。宏结束时 PREV_ROWSDOWN(和 ROWSDOWN)的值会丢失吗?
ROWSDOWN = InputBox("enter no.of rows DOWN to move the cells (0=no change, - =move UP)", "VerticalMove", _
PREV_ROWSDOWN) 'should set default as value entered last time the macro run
PREV_ROWSDOWN = ROWSDOWN ''NW-not saved after macro finished, default changed to "0"
我怎样才能做到这一点?
【问题讨论】: