UpperCase changes date format

M

MrPetreli

I have a very unusual problem with the below code, which for some reaso
changes the date format on all cells in my spreadsheet from dd/mm/yyy
to mm/dd/yyyy. I tried to solve it but not luck with If x.Value
IsDate(x.Value) Then Exit Sub



Sub Uppercase()

Application.ScreenUpdating = False


' Loop to cycle through each cell in the specified range.
Set URange = Selection
For Each x In URange
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)

If x.Value = IsDate(x.Value) Then Exit Sub

Next

End Su
 
G

GS

MrPetreli formulated the question :
I have a very unusual problem with the below code, which for some reason
changes the date format on all cells in my spreadsheet from dd/mm/yyyy
to mm/dd/yyyy. I tried to solve it but not luck with If x.Value =
IsDate(x.Value) Then Exit Sub


Try...

Sub Uppercase()
Application.ScreenUpdating = False
Dim x As Range
For Each x In Selection
If Not IsDate(x.Value) Then x.Value = UCase(x.Value)
Next 'x
Application.ScreenUpdating = True
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top