+ Reply to Thread
Results 1 to 16 of 16

Help With VBA Code to input use rform Data.

  1. #1
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Help With VBA Code to input use rform Data.

    Hi guys & gals, I'm new here and also fairly new to VBA. I have a userform I want to use to fill in a table on a worksheet. I have the clear and Cancel buttons working fine but the submit form button is not working. Bellow is the code I have, your help is appriciated!
    Please Login or Register  to view this content.
    Thanks!
    Last edited by Invicta084; 01-23-2014 at 12:25 PM. Reason: Comply with rules

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Help With VBA Code

    okay, a couple of things

    First - the moderators will probably tell you to make the subject a little more descriptive...
    Second - check the FAQ's about using code tags
    3rd - what do you mean by "not working"? - you get an error? excel locks up? you computer starts smoking? you don't get the results you expected?

    inquiring minds want to help....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,011

    Re: Help With VBA Code

    Please define "not working".

    For constructive diagnostic testing, please provide a sample workbook.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    Hi thanks for the replies, i fixed the rule issues sorry should have read them prior to posting. now I know. So the problem I'm having is once i fill out the userform I created and use the submit button it doesn't do anything. Out of ignorance how do i attache a sample work book? ill paste the data into a purged sheet.

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Help With VBA Code to input use rform Data.

    have you stepped through the code?....In VBA you can set a breakpoint at the top of the code and then press F8 to step through each line of code....you can "hover" a variable and it will tell you the value or open the local windows and look at the variable as they changed on each step....some folks like using the immediate window to test portions of IF Statements....

  6. #6
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    I just tried it and it stops right at the first line. Not sure what the issue with it, I checked to make sure the names are the same for the button.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Help With VBA Code to input use rform Data.

    what happens when you press F8?

  8. #8
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    It jumps past the code I posted and goes to
    Please Login or Register  to view this content.
    which I have below it to populate the form but it seems to work and populates the form. If I keep going through F8 it highlights every line of code under that heading then opens the userform.

  9. #9
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Help With VBA Code to input use rform Data.

    this might be time to upload a file....the FAQ's explain how....but basically click on Go Advanced and you'll see a button to attach files....

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,011

    Re: Help With VBA Code to input use rform Data.

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  11. #11
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    Okay so what I am trying to do is fill out the userform with information and have it populate the table shown in "Before" Tab to Show what is it "After", depending on what info is typed in. This would ideal be able to find the next Empty row and input the information every time "Submit Form" is clicked. I don't want to get to far ahead of my self here but if I could get it to Copy the blank row and paste it with the formulas in them so I can ideally just indefinitely use submit to make the table. The form headers have the same or close to the same headers on the before/after sheet. The greenish cells are formula and the tan and input. I think I covered everything


    Test File.xlsm

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,011

    Re: Help With VBA Code to input use rform Data.

    I guess when you look at it, it falls into place and, maybe, if you'd defined "not working" as requested, you probably could have save yourself some time.

    Please Login or Register  to view this content.
    Wrong on several levels. Worksheet needs to be Worksheets as it's the Worksheets collection to which you refer. In the brackets is the name of the sheet, which is a text string and would be in quotes ("). Or it could be an index number in the brackets. Whichever, the Worksheet needs to exist, which appears not to be the case in your sample workbook.

    Regards, TMS

  13. #13
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    Thanks TMS!!! Seems to be at least placing the information in the sheet now! Sorry for being confusing I'm new to VBA and the forum so I do appreciate the help. Is there a way I can make the entry form stay up after the data was submitted and just have a message pop up that says is was Successful?

    Cheers,
    Invicta

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,011

    Re: Help With VBA Code to input use rform Data.

    The form was huge and didn't actually fit on my laptop screen ... I actually had trouble seeing the Submit button to press it.

    You could use a MsgBox but it's a bit of a pain having to acknowledge that before moving on.

    One way is to have a Label at the bottom of the form and set the caption to, for example, "record submitted". You could then clear that when you select another input field.

    Regards, TMS

  15. #15
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Help With VBA Code to input use rform Data.

    Yeah I have large monitors that I'm displaying the form on. Thanks a lot for your help TMS!

    Cheers,

    Invicta

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,011

    Re: Help With VBA Code to input use rform Data.

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Replies: 2
    Last Post: 12-17-2013, 11:51 AM
  2. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  3. Replies: 2
    Last Post: 03-09-2013, 04:30 AM
  4. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  5. Replies: 0
    Last Post: 10-06-2006, 09:05 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