
Option Explicit
Sub Data()
Dim Mesi As Integer, i As Integer
If Not IsNumeric(Cells(2, 2)) Or Cells(2, 2).Value < 1 Then MsgBox "Inserire numero mesi": Exit Sub
Mesi = Cells(2, 2).Value
If Not IsDate(Cells(2, 1)) Then
MsgBox "Inserire una data valida"
Else
For i = 3 To Mesi + 1
Cells(i, 1).Value = DateAdd("m", i - 2, Cells(2, 1).Value)
Next i
End If
End Sub
|
