+ Reply to Thread
Results 1 to 5 of 5

VBA Userform sending incomplete data

  1. #1
    Registered User
    Join Date
    09-25-2008
    Location
    Manchester UK
    Posts
    38

    VBA Userform sending incomplete data

    Hi,

    hope you can help - just started using VBA recently - trying to build a userform that will send information to a spreadsheet that will record all entries made - all of the selections from the form will be present on individual rows in the spreadsheet

    there are many fields on the userform (text entries, drop down boxes, radio buttons) and if one field has not been filled in by the user then a message box appears asking the user to fill in the relevant field

    what im struggling with is how to stop the form sending any data to the spreadsheet when not all the fields have been completed.


    currently:
    - no data is sent to the spreadsheet if the first field on the userform (choice is 1 of 4 radio buttons) has not been completed (even when all of the other fields are complete)
    - if the first field is complete it will always get sent to the spreadsheet...along with any other fields that have been completed
    - all of the other fields on the userform are only ever sent when the first field is complete


    my code is as follows: (included the first two fields from the form...field one is a choice of four options....field two is a drop down box selection....the other fields on the form are in the same sort of format eg ActiveCell.Offset(0, 2) = xxx)

    Please Login or Register  to view this content.
    Ive tried a few changes but am stuck - any help would be appreciated as well as any good VBA tutorial sites that anyone can recommend

    Many thanks!
    Last edited by Newport Count; 09-01-2010 at 04:03 PM.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: VBA Userform sending incomplete data

    hi Newport Count
    I see you have 34 posts here and you joined on 25 Sep 2008. I suppose you've never read forum rules.

    Your post breaking rule # 3


    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:

    Please Login or Register  to view this content.
    ... and appear like this when posted:

    Code:
    your code here ...
    and here ...
    and here
    You can also type the code tags in manually if you prefer. For more information about these and other tags, click here.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Registered User
    Join Date
    09-25-2008
    Location
    Manchester UK
    Posts
    38

    Re: VBA Userform sending incomplete data

    Ive been playing around with the code - I placed some message boxes from various fields (if cells were not complete)

    eg -

    Please Login or Register  to view this content.

    before the code for the first field and just after:

    Please Login or Register  to view this content.
    it seems to have worked - although the fields that i cant add similar code to, are the fields on the user form where radio buttons are grouped into a frame so only one can be chosen

    is there a similar code for radio buttons in frames? to make a message box appear if one hasnt been selected?

    if you look at my original code above the message box appears if (Pool, Snooker, Billiards or NineBall) isnt chosen using an ELSE function - any way around this?
    i have 3 similar framed radio buttons on the form - only one value can be chosen from each

    Thank you!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Userform sending incomplete data

    is there a similar code for radio buttons in frames? to make a message box appear if one hasnt been selected?
    There shouldn't be any need. Set one of the option buttons to True at design time; then there will always be one ticked.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    09-25-2008
    Location
    Manchester UK
    Posts
    38

    Re: VBA Userform sending incomplete data

    I need the correct option to be chosen though - so they are all blank to begin with until one is chosen

+ 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