jeudi 7 avril 2016

When ElseIf condition is true, statements for else if are not happening.

enter code here Private Sub cbo_Loc_Change() Dim Date1 As Date Dim Row As Integer Row = ActiveCell.Row If cbo_Loc.Value = TDS Then Date1a = Cells(Row, 5).Value T1a = DateAdd("ww", 6, Date1a) Cells(Row, 6).Formula = T1a T1b = DateAdd("ww", 8, Date1a) Cells(Row, 7).Formula = T1b ElseIf cbo_Loc.Value = SS Then T1a = DateAdd("M", 18, Date1a) Cells(Row, 6).Formula = T1a T2b = DateAdd("m", 6, Date1a) Cells(Row, 7).Formula = T1b End If

                   End Sub

The If- Else statement above should add 6 and 8 weeks to date1a when the if condition is met, and add 18 and 24 months to date1a when else if condition is met. When ElseIf condition is met, the statements under it are not happening. Can anyone please take a look at it and find what may be the problem.

Thanks,

Aucun commentaire:

Enregistrer un commentaire