View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Patrick Simonds Patrick Simonds is offline
external usenet poster
 
Posts: 258
Default Problem limiting characters

Is there anyway to convert the current/active cell (after the value is
assigned) to display only first 15 characters?


"Tom Ogilvy" wrote in message
...
You would need to do it a cell at a time - left can't operate on a
multicell range.

Private Sub Worksheet_Calculate()
Dim cell as Range
On Error GoTo Finish
Module1.UnprotectWorkSheet
for each cell in Me.Range("A2:A301")
cell.Value = Left(cell.offset(0,1).Value, 15)
Next
Finish:
End Sub

--
Regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Not sure why the code below does not work. It woks fine if I use
Me.Range("A2:A301").Value = Me.Range("B2:B301").Value But I need the
returned value to be limited to only the first 15 characters. When I run
the code below, no value is placed into column A.


Private Sub Worksheet_Calculate()

On Error GoTo Finish

Module1.UnprotectWorkSheet

Me.Range("A2:A301").Value = Left(Me.Range("B2:B301").Value, 15)

Finish:

End Sub