+ Reply to Thread
Results 1 to 3 of 3

Excel Userform-Check if line 3 is empty

  1. #1
    Registered User
    Join Date
    05-14-2013
    Location
    Tampa
    MS-Off Ver
    Excel 2007
    Posts
    2

    Excel Userform-Check if line 3 is empty

    I have a textbox on a userform in Excel for an address and the text is set to wrap, but I'd like to check if line 3 is empty. I've tried various method of extracting each of the lines to store them into variables, which I would later check, but none have worked. Could someone kindly point me in the right direction?

    Thanks in advance.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Excel Userform-Check if line 3 is empty

    Welcome to the forum!

    Set the Multiline property to True, not Wordwrap, then use Split().

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-14-2013
    Location
    Tampa
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Excel Userform-Check if line 3 is empty

    Thanks! I made a slight adjustment to use this as error validation:

    s() = Split(Address_txt.Value, vbLf)
    If UBound(s) + 1 < 3 Then
    MsgBox ("Address must be a minimum of 3 lines. Please check your entry!")
    End If

    Is there a way to check line 3 for a space or carriage return? Sometimes pasting 2 lines will also add a carriage or empty space to line 3, which may fool the code above.

    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2010 - Userform - VBA How to stop ‘Job No’ from duplicating itself on next empty row
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2015, 12:25 PM
  2. [SOLVED] Need help in code to add save data from userform to next empty line in excel
    By MedSter2015 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-23-2014, 01:51 AM
  3. [SOLVED] Excel 2007 VBA - Multiple line header adds empty line in between
    By ChrisPatterson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2014, 08:54 AM
  4. Empty cells not evaluating as empty - multiple check methods tried
    By rafadavidc in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-03-2014, 05:54 PM
  5. [SOLVED] If one cell in line turn empty then entire line turns empty
    By Cristy0505 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-19-2013, 06:02 AM
  6. Check range A10 to A45 and if cell not empty then same line in B must have value
    By CAVA30 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-08-2013, 09:25 PM
  7. EXCEL - VBA - Check USERFORM changes
    By Yona in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2012, 05:06 AM

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