ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limit text length with inputBox (https://www.excelbanter.com/excel-programming/331397-limit-text-length-inputbox.html)

BigDave[_7_]

Limit text length with inputBox
 

Here is the code I have:


Dim csComment As String
csComment = InputBox("Please enter your comment." & Chr(10) &
Chr(10) & "Comments are not required for No responses")
ActiveSheet.Range("l200") = csComment


I need to limit the text length to 40 characters or less. This
information will eventually be copied into a another workbook that
serves as a data sheet for a PivotTable.

BTW - I really appreciate all of the help I've recieved here. vb used
to really scare me and I stayed way clear of it. Not anymore. I've
got much to learn yet, but you guys have really helped me out a lot.
Thanks in advance!!!


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=377905


Mike Q.

Limit text length with inputBox
 
Hi BigDave,

This should work

Sub LimitMyComment()

Dim csComment As String * 40

csComment = Application.InputBox("Please enter your comment." & Chr(10)
& _
Chr(10) & "Comments are not required for No responses", Type:=2)
ActiveSheet.Range("i200") = csComment

End Sub

"BigDave" wrote:


Here is the code I have:


Dim csComment As String
csComment = InputBox("Please enter your comment." & Chr(10) &
Chr(10) & "Comments are not required for No responses")
ActiveSheet.Range("l200") = csComment


I need to limit the text length to 40 characters or less. This
information will eventually be copied into a another workbook that
serves as a data sheet for a PivotTable.

BTW - I really appreciate all of the help I've recieved here. vb used
to really scare me and I stayed way clear of it. Not anymore. I've
got much to learn yet, but you guys have really helped me out a lot.
Thanks in advance!!!


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=377905



BigDave[_8_]

Limit text length with inputBox
 

Fan-bloody-tastic!!! Thanks

--
BigDav
-----------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...nfo&userid=774
View this thread: http://www.excelforum.com/showthread.php?threadid=37790



All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com