Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sam
 
Posts: n/a
Default Excel automatically changes the formatting of the cell to "Time"

Hello,

I have a long column of numbers [dates in the YY:DD format]. I wanted to
replace
":61" to ":59". Even though the cells are initially formatted as Text, as
soon as I make the change, Excel changes the formatting to Time, and the cell
with the change now has text ":59:00" in it.

Is it possible to force Excel to keep the cells formatted as Text?

Thank you!
  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Sam,

If the cells are truly formatted as text (Format - Cells - Number - Text),
the formatting should never change, and you should always see exactly what
you've typed. Give us an example of a cell before you've made the change,
and tell us what Format - Cells - Number tab indicates.
--
Earl Kiosterud
www.smokeylake

"Sam" wrote in message
...
Hello,

I have a long column of numbers [dates in the YY:DD format]. I wanted to
replace
":61" to ":59". Even though the cells are initially formatted as Text, as
soon as I make the change, Excel changes the formatting to Time, and the
cell
with the change now has text ":59:00" in it.

Is it possible to force Excel to keep the cells formatted as Text?

Thank you!



  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

When you do an Edit|Replace, excel will "help" you and change the value to time
and it helped changing the cell's format to custom, too ([h]:mm:ss). (Well, it
did for me in xl2003).

Manually typing the new entry didn't do it. Edit|Replace was too helpful.



Earl Kiosterud wrote:

Sam,

If the cells are truly formatted as text (Format - Cells - Number - Text),
the formatting should never change, and you should always see exactly what
you've typed. Give us an example of a cell before you've made the change,
and tell us what Format - Cells - Number tab indicates.
--
Earl Kiosterud
www.smokeylake

"Sam" wrote in message
...
Hello,

I have a long column of numbers [dates in the YY:DD format]. I wanted to
replace
":61" to ":59". Even though the cells are initially formatted as Text, as
soon as I make the change, Excel changes the formatting to Time, and the
cell
with the change now has text ":59:00" in it.

Is it possible to force Excel to keep the cells formatted as Text?

Thank you!


--

Dave Peterson
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

I think you could use a column of helper cells:

=substitute(a1,":61",":59")
(and dragdown)

Then edit|copy
and edit|Paste special|Values over the original range
(then delete that column of helper cells)

Or you could select the range and then run a macro:

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range
Dim fStr As String
Dim tStr As String

fStr = ":59"
tStr = ":61"

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Selection, _
Selection.Cells.SpecialCells _
(xlCellTypeConstants, xlTextValues)).Cells
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "Please select some cells with values!"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell
.Value = Application.Substitute(.Value, fStr, tStr)
End With
Next myCell

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Sam wrote:

Hello,

I have a long column of numbers [dates in the YY:DD format]. I wanted to
replace
":61" to ":59". Even though the cells are initially formatted as Text, as
soon as I make the change, Excel changes the formatting to Time, and the cell
with the change now has text ":59:00" in it.

Is it possible to force Excel to keep the cells formatted as Text?

Thank you!


--

Dave Peterson
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
Formatting Columns in Excel defacto100 Excel Discussion (Misc queries) 1 May 16th 05 03:07 PM
Excel conditional formatting error Bob Excel Discussion (Misc queries) 9 May 11th 05 03:17 AM
How do I automatically send daily email of updated Excel workbook. How to automate emails with excel file. Excel Discussion (Misc queries) 1 May 9th 05 08:55 PM
Excel shifts to wrong worksheet automatically Tom77 Excel Worksheet Functions 1 February 24th 05 08:10 PM
pasting into an excel template without losing the formatting chachi Excel Discussion (Misc queries) 2 January 14th 05 04:08 AM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"