Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange formatting behavior
Can anyone tell me why/how the code below causes the cell format in the
column to the right to change from a number format to a text format. I should expand on this a little. If I enter a number say in cell F8 and use the arrow button to go down to cell F9, everything is fine. By fine I mean that the : is placed between the numbers I enter and the format of the cell to the right does not change from a Number format to a Text format. But if I enter a number in cell F8 and use the right arrow to move to the next cell to the right, the : is placed between the numbers but the cell format to the right changes to a text format. All cells in column F are formatted for Text, all cell in column G are formatted for Numbers. If Not Application.Intersect(Target, Range("F3:F8000")) Is Nothing Then If ActiveCell < "" Then GoTo ErrorHandler With ActiveCell .NumberFormat = "@" e = Left(Format(Target.Value, "0000"), 4) Application.EnableEvents = False Target.Formula = Left(e, 2) & ":" & Right(e, 2) End With End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange formatting behavior
Solved my problem by eliminating:
With ActiveCell .NumberFormat = "@" and End With "Patrick Simonds" wrote in message ... Can anyone tell me why/how the code below causes the cell format in the column to the right to change from a number format to a text format. I should expand on this a little. If I enter a number say in cell F8 and use the arrow button to go down to cell F9, everything is fine. By fine I mean that the : is placed between the numbers I enter and the format of the cell to the right does not change from a Number format to a Text format. But if I enter a number in cell F8 and use the right arrow to move to the next cell to the right, the : is placed between the numbers but the cell format to the right changes to a text format. All cells in column F are formatted for Text, all cell in column G are formatted for Numbers. If Not Application.Intersect(Target, Range("F3:F8000")) Is Nothing Then If ActiveCell < "" Then GoTo ErrorHandler With ActiveCell .NumberFormat = "@" e = Left(Format(Target.Value, "0000"), 4) Application.EnableEvents = False Target.Formula = Left(e, 2) & ":" & Right(e, 2) End With End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Strange behavior | Excel Programming | |||
Strange behavior | Excel Discussion (Misc queries) | |||
Strange TAB behavior | Excel Programming | |||
Strange behavior | Setting up and Configuration of Excel | |||
Strange behavior. | Excel Discussion (Misc queries) |