View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
nowfal[_42_] nowfal[_42_] is offline
external usenet poster
 
Posts: 1
Default conditional formating


Hi Bob,
I have sorted out the problem with a macro. Now fo
another page i am trying with the same code but i wanted the same shee
code in two places, and i try to writed the following way, but i a
failing can u have a look on this, if possible pls correct it.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim iPos As Long
On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$B$8" Then
If Len(.Value) 50 Then
iPos = InStrRev(.Value, " ", 51)
If iPos 0 Then
.Offset(1, 0).Value = Right(.Value, Len(.Value) - iPos)
.Value = Left(.Value, iPos)
End If
With Target
If .Address = "$A$10" Then
If Len(.Value) 50 Then
iPos = InStrRev(.Value, " ", 51)
If iPos 0 Then
.Offset(1, 0).Value = Right(.Value, Len(.Value) - iPos)
.Value = Left(.Value, iPos)
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

thanks and regards
nowfa

--
nowfa
-----------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...fo&userid=1000
View this thread: http://www.excelforum.com/showthread.php?threadid=39553