Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Andy Tallent
 
Posts: n/a
Default Upper Case and date format issue

I'm using some code from Chip Pearsons site to convert a range to Upper Case.

Sub ConvertToUpperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = UCase(Rng.Value)
End If
Next Rng
End Sub

I've noticed that whenever there is a date in the range it "flips" the
format. Thus 01/02/2004 is converted to 02/01/2004. Is there a way around
this?

Many Thanks

Andy

--
Andy Tallent
  #2   Report Post  
Duke Carey
 
Posts: n/a
Default

I'm not seeing that behavior on my XL2000 instance, but if you want to, you
can modify Chip's code by changing this line

If Rng.HasFormula = False Then

to

If Not Rng.HasFormula And Not IsDate(rng) Then




"Andy Tallent" wrote:

I'm using some code from Chip Pearsons site to convert a range to Upper Case.

Sub ConvertToUpperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = UCase(Rng.Value)
End If
Next Rng
End Sub

I've noticed that whenever there is a date in the range it "flips" the
format. Thus 01/02/2004 is converted to 02/01/2004. Is there a way around
this?

Many Thanks

Andy

--
Andy Tallent

  #3   Report Post  
Andy Tallent
 
Posts: n/a
Default

Hi Duke,

This is working perfectly now. Many thanks for your help.

Regards

Andy

"Duke Carey" wrote:

I'm not seeing that behavior on my XL2000 instance, but if you want to, you
can modify Chip's code by changing this line

If Rng.HasFormula = False Then

to

If Not Rng.HasFormula And Not IsDate(rng) Then




"Andy Tallent" wrote:

I'm using some code from Chip Pearsons site to convert a range to Upper Case.

Sub ConvertToUpperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = UCase(Rng.Value)
End If
Next Rng
End Sub

I've noticed that whenever there is a date in the range it "flips" the
format. Thus 01/02/2004 is converted to 02/01/2004. Is there a way around
this?

Many Thanks

Andy

--
Andy Tallent

  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

If you went back to the original formula without eliminating dates
what happens if you use .formula instead of .value

In reality I would limit the scope to text constants
http://www.mvps.org/dmcritchie/excel/proper.htm#upper

and if you selected an *entire* column you might notice
a tremendous difference. My system is 600 MHz that would
take 6 minutes on my machine with lots of paging with only
128MB RAM. On a 3 GHz machine you would have to
choose 5 columns, but with a big machine you probably
would not be paging so might run 1000 times faster so
it might be barely noticeable to someone on a big machine.
But you might try the comparison yourself.

With a macro as described on my page, you should be
able to convert 200 cells even though selecting an entire
column faster than it took to select the macro.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Andy Tallent" wrote in message ...
Hi Duke,

This is working perfectly now. Many thanks for your help.

Regards

Andy

"Duke Carey" wrote:

I'm not seeing that behavior on my XL2000 instance, but if you want to, you
can modify Chip's code by changing this line

If Rng.HasFormula = False Then

to

If Not Rng.HasFormula And Not IsDate(rng) Then




"Andy Tallent" wrote:

I'm using some code from Chip Pearsons site to convert a range to Upper Case.

Sub ConvertToUpperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = UCase(Rng.Value)
End If
Next Rng
End Sub

I've noticed that whenever there is a date in the range it "flips" the
format. Thus 01/02/2004 is converted to 02/01/2004. Is there a way around
this?

Many Thanks

Andy

--
Andy Tallent



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting numbers to date format from csv files FiBee Excel Discussion (Misc queries) 1 January 12th 05 01:30 PM
Need help troubleshooting an array formula XLXP on Win2K KR Excel Worksheet Functions 1 December 13th 04 07:41 PM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM


All times are GMT +1. The time now is 04:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"