View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default conditional formating

Do you want the 76+ characters simply moved to A2, or A1 to be truncated at
75, and 76+ characters simply moved to A2.

I will give you both and you can pick. But what happens on a subsequent
change?

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$A$1" Then
If Len(.Value) 75 Then
.Font.Size = 8
.Offset(0, 1).Value = Right(.Value, Len(.Value) - 75)
Else
.Font.Size = 10
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub



Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$A$1" Then
If Len(.Value) 75 Then
.Font.Size = 8
.Value = Left(.Value, 75)
.Offset(0, 1).Value = Right(.Value, Len(.Value) - 75)
Else
.Font.Size = 10
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"nowfal" wrote in
message ...

Mr.Bob and Mr.Norman thanks
It works perfectly, But one more related question which i asked
yesterday in a different thread. If the cell A1 crossed the 75
character any possibility to move the 76th character to A2 i mean
continuation. For me it is very useful question, to print a cheque leaf
I hope both of you will do something on it.
thanks in advance.
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile:

http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=395535