Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting numbers to date format from csv files | Excel Discussion (Misc queries) | |||
Need help troubleshooting an array formula XLXP on Win2K | Excel Worksheet Functions | |||
Formula to list unique values | Excel Worksheet Functions | |||
Using formulas to determine date in one cell based on date in anot | Excel Worksheet Functions |