View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PatK PatK is offline
external usenet poster
 
Posts: 96
Default Combo Box Question

Thanks, Lloyd..that works!

"Simon Lloyd" wrote:


Hi if CLASS A This project is a complex project that will last more than
1 year
CLASS B This project is a medium complex project that will last < 1
year
CLASS C This is a relatively simply project lasting less than 1 year.
appears anywhere in the range shown in my code it will be trimmed down
to just the Class X so paste the code below into the worksheet module
(dont forget to change the range to as much of the sheet as you want)
and try pasting any of your list in to a cell you will find it gets
cut down to your requirement!

Hope it helps,
Regards,
Simon

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mycell As Range
Dim rng As Range
Set rng = Range("A2:C10")
For Each mycell In rng.Cells
If LCase(mycell.Value) Like LCase("Class A*") Then
mycell.Value = Left(mycell.Value, Len("This project is a complex
project that will last more than 1 year") - 58)
ElseIf LCase(mycell.Value) Like LCase("Class B*") Then
mycell.Value = Left(mycell.Value, Len("This project is a medium
complex project that will last less than 1 year") - 65)
ElseIf LCase(mycell.Value) Like LCase("Class C*") Then
mycell.Value = Left(mycell.Value, Len(" This is a relatively simply
project lasting less than 1 year.") - 55)
ElseIf mycell.Value = "" Then

End If
Next mycell

End Sub


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=566863