lundi 26 décembre 2016

Combining Two 'if-statement' .second is depend on the first

second 'If' can come only after the first statement so there will not be run time error- due to the fact that "el_rule" can be sometimes nothing.. so i can't put both in same statement with AND. but after both 'if statement' i want same lines of code will run if one of the if statement will not happens(else)... is my only option is too just write it twice? like on following code? thanks for any help!

If el_rule.Length > 0 Then
                    If LCase(ActiveCell.Offset(0, el_rule.Item(0).Attributes.getNamedItem("column_number").Text).Value) = LCase(el_rule.Item(0).Attributes.getNamedItem("value").Text) Then
                     Set el = xDoc.SelectNodes("/Modes_of_auto_painting/Autopaint_lines_per_simulatorType/simulator[translate(@apiType, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='" & lookfor & "']/rule/formatting")

                 Else
                   Set el =.......   -code first time
               End If
else
                   Set el =.......    -code second time
               End If

Aucun commentaire:

Enregistrer un commentaire