+ Reply to Thread
Results 1 to 4 of 4

Userform textbox value to cell only if textbox not empty

  1. #1
    Forum Contributor
    Join Date
    08-14-2016
    Location
    Warrington, England
    MS-Off Ver
    MS 365
    Posts
    168

    Userform textbox value to cell only if textbox not empty

    Hi all,

    i have the below code:

    Please Login or Register  to view this content.
    When the submit btn is clicked it will past the value of the combobox followed by " - " to separate when it also pastes in the value from a textbox. The problem I am having is that this will populate each cell with " - " even if the combobox and textbox is empty which causes a few problems with reporting. I need this code to ONLY post to the cell if the combobox and textbox both contain text, if either of them are empty it will not post anything at all. I have tried a few solutions such as writing the code to clear cells if they equal " - " but it isnt very efficient. Can anyone advise of a quick efficient way to get this to work?
    Excel Beginner

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform textbox value to cell only if textbox not empty

    One idea, longer to type but more efficient that going back to clear them, also avoids the dash if only one of the two is blank and the other has something:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    08-14-2016
    Location
    Warrington, England
    MS-Off Ver
    MS 365
    Posts
    168

    Re: Userform textbox value to cell only if textbox not empty

    Hi Arkadi, sorry for late reply but the above worked a treat, thanks for the help! Marked as solved and rep added.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform textbox value to cell only if textbox not empty

    Glad I could help
    Thanks for the rep and marking the thread as solved!

+ 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. [SOLVED] userform condition if textbox is empty do nothing
    By a.hudrea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2016, 08:04 AM
  2. [SOLVED] Paste Userform textbox values into next empty cell on a sheet
    By dubcap01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2015, 04:51 AM
  3. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  4. [SOLVED] Checking for empty textbox and setfocus the empty textbox
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-23-2013, 02:49 PM
  5. Message Box if any of userform textbox are empty
    By Rey Ocampo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2012, 02:42 PM
  6. UserForm textbox data to empty cells
    By RLWells in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2012, 02:42 AM
  7. Replies: 3
    Last Post: 05-07-2012, 09:46 PM

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