I'm trying to create a dynamic user form through vba. Since I'm not real familiar with forms, I downloaded an example to kind of reverse engineer. When going through the code, I noticed a line using a syntax I'm not familiar with:
This code disables the button if the spinbutton1 value is not greater than 0. I didn't know you could do that...pretty cool trick. Seems more efficient then:
So, I'm wondering how exactly this syntax works. Does throwing parenthes around a statment like that automatically ask vba to evaluate the statment to true or false? I tested and the same line works with the parentheses removed... Anyone have any insight on this?
Code:
CmdBttnDE.Enabled = (SpinButton1.Value > 0)
This code disables the button if the spinbutton1 value is not greater than 0. I didn't know you could do that...pretty cool trick. Seems more efficient then:
Code:
if not SpinButton1.Value > 0 then CmdBttnDE.Enabled = False
So, I'm wondering how exactly this syntax works. Does throwing parenthes around a statment like that automatically ask vba to evaluate the statment to true or false? I tested and the same line works with the parentheses removed... Anyone have any insight on this?
Last edited: