+ Reply to Thread
Results 1 to 4 of 4

Blank TextBox values and Listbox

  1. #1
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    57

    Blank TextBox values and Listbox

    I have a ListBox populated by TextBoxes in a UserForm. Currently it will not update or save new data if any of the textboxes where numbers are expected are BLANK.. what is the way around this .. here is the code I am using for SAVING data to a sheet
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    3,201

    Re: Blank TextBox values and Listbox

    replace all the rows with the respective cell equal to the respective textbox.
    you will either get a blank or zero.

    Please Login or Register  to view this content.
    With
    Please Login or Register  to view this content.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,450

    Re: Blank TextBox values and Listbox

    You are overcomplicating your Userform.

    A few Ideas that might help you.

    Rule 1. Never Rename your controls, It makes Coding Harder


    Please Login or Register  to view this content.
    The above code enters the numbers 1 to 100 in textboxes 1 to 100
    How would you do that if each Textbox has a unique name?


    Rule 2. Number Each Control with the Column Number of its Source Data.


    Please Login or Register  to view this content.
    The above code loads Textboxes 1 to 100 with the data in row 1, columns 1 to 100

    Please Login or Register  to view this content.
    The above code Stores Textboxes 1 to 100 in row 1, columns 1 to 100


    Rule 3. You can have more than one control storing data to the same cell
    or
    reading data from the same cell

    That is not a problem. As long as they are not the same type of control.

    Eg. Textbox1, Combobox1, Label1 can all read / write to the same cell

    Rule 4. You can use your Titles as the default text of a cell to avoid having labels
    This makes your userforms cleaner.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    57

    Re: Blank TextBox values and Listbox

    Many thanks for your quick response.
    This is what I had in my original version, I wrote the original code on a system that used a Comma as a decimal separator, I then gave the workbook to a client that used a Full Stop. The Values being stored where ignoring the comma and the values where then being read as text and not a number. Hence the need for the Change function (0,025 was being stored as 25) and everything got screwed up.

+ 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. Need to link my Dictionary to Textbox and Listbox values
    By DarrenSmith1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2021, 03:48 AM
  2. [SOLVED] Multiplying TextBox Value with Values in ListBox
    By hpernaf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2020, 10:26 AM
  3. Trying to lock a listbox IF another textbox value has IS BLANK
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2015, 03:01 PM
  4. [SOLVED] Filter Listbox Values based on Textbox input
    By redocs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 04:59 AM
  5. [SOLVED] excel vba filter values to listbox from combobox and save edit values in textbox
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2013, 08:42 AM
  6. combining listbox values to a textbox
    By st0kvis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2011, 06:55 AM
  7. Textbox values won't place into selected Listbox rows
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2010, 07:34 AM

Tags for this Thread

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