View Single Post
  #7   Report Post  
tkaplan
 
Posts: n/a
Default Custom Validation


oops...now i feel stupid. i had two the application open twice. i closed
out and now it works:)

expanding on the code that you provided for me, i would like to modify
it as follows (this would only apply to cells b9,10,11 because all
other cells are locked so user cannot make changes anyways.)

the truncated text from cell b9 should be appended to the beginning of
cell b10. but then if after that change b10 becomes too long, i want
that text to be appended to cell b11. if cell b11 becomes too long, i
would like a message box prompting the user to send additional comments
in a seperate file and truncate after the max length.

so here's what i have.
If Len(Target.Value) maxLen Then
TruncatedText = Mid(Target.Value, maxLen + 1)
MsgBox "Cell: " & Target.Address(0, 0) & " has been truncated!" _
& vbLf & TruncatedText & vbLf & "was chopped!"
Application.EnableEvents = False
Target.Value = Left(Target.Value, maxLen)
Target.Activate
ActiveCell.Offset(1, 0).Activate
If ActiveCell.Address = "$B$12" Then
MsgBox ("You have reached the limit for the comments." &
vbNewLine & "Please attach any additional comments in a seperate
file.")
Else
ActiveCell.Value = TruncatedText & vbLf & ActiveCell.Value
End If
End If

This works to append the text. the part i dont know how to do is how to
test and check to see if the new cell is too long, to loop through this
process again. i figure it would be a loop while cell length max
length, just not sure how to implement.

THank you.


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=483601