+ Reply to Thread
Results 1 to 3 of 3

Limit text length with inputBox

  1. #1
    Registered User
    Join Date
    03-30-2004
    Posts
    31

    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!!!

  2. #2
    Mike Q.
    Guest

    RE: 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
    >
    >


  3. #3
    Registered User
    Join Date
    03-30-2004
    Posts
    31
    Fan-bloody-tastic!!! Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1