我正在尝试创建一个函数,该函数将允许我传递一个已添加到对象的变量。我希望能够将一行值上移到Form的下一行。我想添加一个变量,这样我就不必继续为每一行重复相同的代码。
Function UpArrow(x As Variant, y As Variant)
Dim TextContent As String
cboOperation +x+ .Value = TextContent
cboOperation +x+ .Value = cboOperation +y+ .Value
cboOperation +y+ .Value = TextContent
答案 0 :(得分:0)
我认为您正在寻找控件集合。
Function UpArrow(x As Variant, y As Variant)
Dim TextContent As String
TextContent = Controls("cboOperation" & x).value
Controls("cboOperation" & x).value = Controls("cboOperation" & y).value
Controls("cboOperation" & y).value = TextContent
End Function