LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 
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 08:32 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"