I'm working on this macro that I've setup in a userform in order to convert dates into either Year, Month, or Day form. I want users to be able to highlight dates in their workbook, activate the form and then select the option button of their choice. Not sure why this isn't working, any help?
HTML:
Private Sub Convert_Click()
Application.ScreenUpdating = False
On Error Resume Next
Application.StatusBar = "Calculating, please wait"
For Each xCell In Selection
If Month = True And xCell > 0 Then
xCell.Value = Month(xCell.Value)
xCell.NumberFormat = "General"
ElseIf Year = True And xCell > 0 Then
xCell.Value = Year(xCell.Value)
xCell.NumberFormat = "General"
ElseIf Day = True And xCell > 0 Then
xCell.Value = Day(xCell.Value)
xCell.NumberFormat = "General"
End If
Next xCell
Application.ScreenUpdating = True
Application.StatusBar = False
Unload Me
End Sub