mercredi 13 mai 2020

drop ist and if coditions, the first if statment is working , but when i change my selection from the drop list nohting changes in the if stat.. why?

  With Range("D2").Validation

 .Delete

.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="=one!E90:E93"

 .IgnoreBlank = True
 .InCellDropdown = True
 .InputTitle = ""
 .ErrorTitle = ""
.InputMessage = ""
 .ErrorMessage = ""
.ShowInput = True
.ShowError = True
 End With

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If Range("D2") = "Monthly" Then

Dim i As Long

Cells(5, 4).Value = DateDiff("M", Cells(3, 4), Cells(4, 4)) + 1

For i = 4 To Cells(5, 4) * 2 Step 2

  Cells(3, i + 2).Value = DateAdd("M", 1, Cells(3, i).Value)

Next i

For i = 3 To Cells(5, 4) + 27

Cells(1, i).Interior.ColorIndex = 16 Cells(11, i).Interior.ColorIndex = 16 Next i

ElseIf Range("D2") = "Quarterly" Then

Cells(5, 4).Value = DateDiff("q", Cells(3, 4), Cells(4, 4))

ElseIf Range("D2") = "Yearly" Then

Cells(5, 4).Value = DateDiff("YYYY", Cells(3, 4), Cells(4, 4))

ElseIf Range("D2") = "SA" Then

Cells(5, 4).Value = DateDiff("yyyy", Cells(3, 4), Cells(4, 4)) * 2

End If

Aucun commentaire:

Enregistrer un commentaire