+ Reply to Thread
Results 1 to 8 of 8

Set textbox class module to look for null values on text box controls

  1. #1
    Registered User
    Join Date
    03-09-2010
    Location
    Cerritos, CA
    MS-Off Ver
    Excel 2010
    Posts
    31

    Set textbox class module to look for null values on text box controls

    Here goes...

    MY PLAN:

    1. I have a form with multiple text boxes (8 lines total; each line with it's own textbox and multiple label captions)
    2. Not all textboxes are required to have a value entered.
    3. When user is finished entering values in their selected textboxes, the cmdAddbutton they click will transfer the form label captions AND the text box entry to a spreadsheet.

    MY PROBLEM:

    When the user clicks the cmdAddbutton, the lines with textboxes that had no data entered into them, are still transferring over to the spreadsheet (labels and null textbox values)

    MY HOPE:

    When the cmdaddbutton is clicked, I only need the line items that have user input in the textbox transferred to the spreadsheet (and not include labels and null textbox values). All my research keeps pointing toward a CLASS MODULE where I can set properties and methods to control all TextBoxes within a form. . I have no idea how to do this.

    MY CODE:

    Please Login or Register  to view this content.
    Can someone provide any guidance or point me in the right direction? I've researched J. Walenbachs VBA power programming and though helpful, my VBA prowess just isn't up to speed yet.

    Anxiously waiting in Cali.

    Best

    pt

  2. #2
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Set textbox class module to look for null values on text box controls

    Do a check while you are iterating through the textboxes to see if the textbox value is null, if value is null then skip, if not copy data.

    Please Login or Register  to view this content.
    Let me know if you need me to be more detailed.

  3. #3
    Registered User
    Join Date
    03-09-2010
    Location
    Cerritos, CA
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Set textbox class module to look for null values on text box controls

    Thank you for the quick reply.

    Do I need to Dim this?

    Yes, please elaborate.

  4. #4
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Set textbox class module to look for null values on text box controls

    Columns 1, 4 and 5 are static
    Column 2 references label 16 (13 + (x * 3)) on the first iteration, and offsets by +3 for each subsequent iteration (16 --> 19 --> 22 etc.)
    Column 3 references textbox and the value of x (1, 2, 3 etc.)

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Set textbox class module to look for null values on text box controls

    Do I need to Dim this? (need --> no, can you --> yes)

  6. #6
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Set textbox class module to look for null values on text box controls

    Let me know if you need anymore help, or upload a test workbook I can work with it.

  7. #7
    Registered User
    Join Date
    03-09-2010
    Location
    Cerritos, CA
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Set textbox class module to look for null values on text box controls

    Poizhan...how can I thank you for that! Truly grateful for your help.

  8. #8
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Set textbox class module to look for null values on text box controls

    Quote Originally Posted by buhwheet View Post
    Poizhan...how can I thank you for that! Truly grateful for your help.
    You're very welcome.

+ 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. Using Class Module for handling events of dynamically created controls
    By jagman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2018, 01:14 PM
  2. [SOLVED] Userform & Dynamic Controls & Class Module
    By sarndt01 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 09-18-2014, 01:53 PM
  3. Replies: 0
    Last Post: 03-08-2014, 08:02 AM
  4. Replies: 1
    Last Post: 10-12-2012, 04:36 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