I think you'd be much better served by using different cells for this kind of
thing.
But if you have to, you could use a worksheet event and have it do the work.
Rightclick on the worksheet tab that should have this behavior and select view
code. Paste this into the code window:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
'only one cell at a time
If .Cells.Count > 1 Then Exit Sub
'only in column A
If Intersect(.Cells, Me.Range("a:a")) Is Nothing Then
Exit Sub
End If
On Error GoTo ErrHandler:
'no errors
If IsError(.Value) Then Exit Sub
'no empty cells
If IsEmpty(.Value) Then Exit Sub
'no formulas
If .HasFormula Then Exit Sub
'only numbers
If IsNumeric(.Value) = False Then Exit Sub
'do the work
Application.EnableEvents = False
.Value = .Value & " - " & .Value + 199
End With
ErrHandler:
Application.EnableEvents = True
End Sub
You'll have to change the range (I used column A). And you may want to use a
line like:
..Value = format(.Value, "000000") & " - " & format(.Value + 199, "000000")
If you have any leading 0's in those numbers that have to be kept.
StargateFanFromWork wrote:
>
> I don't know what to call what I need to do, so I'll describe the situation.
>
> If I type in 100800 in A1, how can cell display that number + 199 so that,
> although I typed in 100800, the cell displays:
>
> 100800 - 100999?
>
> I usu. just do separate cells and do an easily addition formula, but I'm
> finding that it would make life easier if I'm just dealing with one cell for
> each range of numbers so that I'm just dealing with column A even though
> there are 2 numbers.
>
> Thanks.
D
--
Dave Peterson