VBA skip lines but not
In a vba script I would like to skip a few lines of code if a checkbox value is true. I can write the whole code within the if (excluding what should be skipped) and else statements, but I would like to avoid doing that since the code creates connections to another database which could slow the process down. The below code is just an example of what I'm trying to do.
if chkbox.value = true then x = test.value + 2 y = x + 2 else y = x + 2 end if
As you can see from the above example if the checkbox value is false then it does not need to run the line "x = test.value + 2" but the rest of the code is exactly the same. thanks for your help in advance
If ChkBox.Value = True Then x = Test.Value +2 Y = X + 2