docs:programming:office_vba:if_end_if

If...End If

If Target = Worksheets("Sheet 1").Range("C2") Then
' do something
End If
Private Sub UpdateAgeNow()
    If IsNull(tbDate.Value) Then
        tbAgeNow.Value = 0
    Else
        Dim ageNow As Double
        ageNow = dateDiff("d", tbDate.Value, Now) / 365
 
        tbAgeNow.Value = Round(ageNow, 2)
    End If
End Sub
  • docs/programming/office_vba/if_end_if.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1