Well it's not really specific to VBA, it's more to programming.
Sometimes, I have more trouble with what looks simple...
I want to create a string of the type: "=(A+B+C+D)"
A,B,C and D are optional, meaning the user can select whichever they want using checkboxes.
Here's a simplified version of what I've done. The problem is that at the beginning, I'm stuck with an extra +.
Any ideas on how to do it properly?
Sometimes, I have more trouble with what looks simple...
I want to create a string of the type: "=(A+B+C+D)"
A,B,C and D are optional, meaning the user can select whichever they want using checkboxes.
Here's a simplified version of what I've done. The problem is that at the beginning, I'm stuck with an extra +.
Any ideas on how to do it properly?
Code:
str = "=("
If A Then
str = str + " + A"
End If
If B Then
str = str + " + B"
End If
If C Then
str = str + " + C"
End If
If D Then
str = str + " + D"
End If
str = str + " )"
'An example of an output: =(+A+C) but I want: =(A+C)