X = x + 1的VBA速记吗? [英] VBA shorthand for x=x+1?
问题描述
Sub btn1_Click()
Static value As Integer
value = value + 1
MsgBox value
End Sub
我发誓,当我在大学里上VB.net课程时,有一种较短的方法来告诉变量在其自身上添加".也许x = + 1.我现在正在使用Access,而不是Visual Studio.当我尝试在VBE中删除+时.我什至删除了Option Explicit
并保持不变
I swear when I was taking a VB.net course in college there was a shorter way to tell a variable to add '' to itself. Maybe x=+1. I am using Access now though instead of visual studio. When I try that within the VBE it removes the +. I even removed Option Explicit
with no change
假设答案是否定的,则没有办法将其简写为& ;;它只是VBA特有的
Assuming the answer will be no, there is no way to short-hand it & its just a peculiarly of VBA
推荐答案
遗憾的是,VBA中没有operation-assignment
运算符.
Sadly there are no operation-assignment
operators in VBA.
(VB.Net中提供了附加分配+=
等)
(Addition-assignment +=
et al are available in VB.Net)
毫无意义的解决方法;
Pointless workaround;
function Inc(ByRef i As Integer)
i = i + 1
end function
...
Static value As Integer
inc value
inc value
这篇关于X = x + 1的VBA速记吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!