تم تنقيح الكود
سابقا لو ضغطت الزر أكثر من مرة فسوف يبدل النتائج مع كل ضغطة
أما الآن سيبدلها مع الضغطة الأولى فقط.
Sub Date2Text()
Const sRow = 7, eRow = 23
Const sCol = 2, eCol = 36
Dim Row As Integer, Col As Integer
Application.EnableEvents = False
Application.ScreenUpdating = False
For Row = sRow To eRow
For Col = sCol To eCol
With Cells(Row, Col)
If .NumberFormat = "d-mmm" Then
.NumberFormat = "@"
If .Value <> "" Then
.Value = Month(.Value) & "-" & Day(.Value)
End If
Else
.NumberFormat = "@"
End If
End With
Next Col
Next Row
Application.EnableEvents = True
Application.ScreenUpdating = True
MsgBox "Done"
End Sub