lundi 15 janvier 2018

Using a variable as a clause in a If statemnet

I would idealy like to create a if statement where the clasue is wheter or not a variable has a value. Currently I have the code below.

If UpdateLimit = vbNo Then

    Limit = InputBox("Please set a line distance limit")


Else

    If LimitNow = vbNo Then

            Limit = InputBox("Please set a line distance limit")


    End If

Which works fine but I would like to change the nested If statement to something like

If Limit (Has Value)) then

    'Do thing 1 

Else 

    Limit= InputBox("Please set a line distance limit") 

End if 

The idea behind this is that on the first run through you define a limit value but the second run through you dont need to. There may be a better way to do this, but LimitNow and UpdateLimit wont be changed on subsiquent run throughs

I hope this makes sense.

Thanks

Aucun commentaire:

Enregistrer un commentaire