Thread: Truncate
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Truncate

Hi Steve
try
Sub Truncate

Dim rng As Range
Dim c As Range
Set rng = Selection
For Each c In rng
c.Value = Left(c.Value, InStr(1, c.Value, "/") - 1)
Next
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Steven wrote:
Hello
Im trying to pices together code from here that will truncate the
text to the left of and including "/". This is what I have so far but
it isnt working.

Sub Truncate

Dim rng As Range
Dim c As Range
Set rng = Selection
For Each c In rng
c.Value = Left(ActiveCell.Value, InStr(1, ActiveCell.Value,
"/") - 1) Next
End Sub

All help is greatly appreciated.
Steven