Just a couple of minor modifications...
I'd check the cells that are in the intersection and use "With Cell" instead of
"With Target". I'd also just ignore any error and continue processing the other
cells.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Cell As Range
Const WS_RANGE As String = "B1:B10"
Application.EnableEvents = False
On Error Resume Next
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each Cell In Intersect(Target, Me.Range(WS_RANGE)).Cells
With Cell
.Value = .Value & " " & .Offset(0, -1).Value
End With
Next
End If
On Error GoTo 0
Application.EnableEvents = True
End Sub
> >The "Unit" of the cell varies from line to line, so this manual
> >formating is not an option to me in this case.
[quoted text clipped - 28 lines]
>
> Gord

Signature
Dave Peterson
Dave Peterson - 07 Apr 2008 00:03 GMT
Another option would be to use Gord's idea, but instead of changing the value,
change the numberformat (kind of what you (the OP) asked for originally:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Cell As Range
Dim myStr As String
Dim iCtr As Long
Dim myFormatStr As String
Const WS_RANGE As String = "B1:B10"
Application.EnableEvents = False
'On Error Resume Next
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each Cell In Intersect(Target, Me.Range(WS_RANGE)).Cells
With Cell
myStr = .Offset(0, -1).Value
myFormatStr = ""
For iCtr = 1 To Len(myStr)
myFormatStr = myFormatStr & "\" & Mid(myStr, iCtr, 1)
Next iCtr
.NumberFormat = "General" & " " & myFormatStr
End With
Next Cell
End If
On Error GoTo 0
Application.EnableEvents = True
End Sub
> Just a couple of minor modifications...
>
[quoted text clipped - 57 lines]
>
> Dave Peterson

Signature
Dave Peterson
Gord Dibben - 07 Apr 2008 00:55 GMT
Thanks Dave.......vigilant as ever.
I appreciate the subtle but important edits.
Gord
>Just a couple of minor modifications...
>
[quoted text clipped - 53 lines]
>>
>> Gord