+ Reply to Thread
Results 1 to 20 of 20

Userform submit VBA

  1. #1
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Userform submit VBA

    Hi Everyone,

    I have created a user form and when a user clicks submit I have manipulated it so that the data in the command box goes to the correct column.

    The problem i'm having is that it goes to the next blank space depending if there's data on the left or right. For example if there's data in cell A1 it would go to C2, I want it in C1 if it's blank

    I would like it so that it will go to the next space in a specific column, regardless if there's data around it.

    Here's the statement I have :

    Please Login or Register  to view this content.
    If anyone could help me I would really appreciate it!!

    Thanks
    Frank
    Last edited by Frankinstyyn; 05-11-2014 at 06:26 AM. Reason: showing code

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Try this for determining the next blank cell in column C.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Thanks Nori, I really appreciate your help.

    Where do I put the code?

    Would you like me to upload the spreadsheet to make it easier for you?

  4. #4
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Fotis1991 View Post
    Welcome to the forum.

    We'd like to help you but first..

    Pls take some minutes to read forum rules and specially-in this case- rule#3 and add code tags around your code.
    Then anyone will be able to help you.
    Hi Fotis1991,

    I've made the necessary changes, apologies and thanks for pointing it out.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    The code I posted would replace this code, which was being used to find lrow in the original code.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Norie View Post
    The code I posted would replace this code, which was being used to find lrow in the original code.
    Please Login or Register  to view this content.
    Hi Norie,

    Thanks for helping, i'm not sure if it's the way I've got the spreadsheet laid out.

    Now it doesn't go into the first space in column C and it overwrites anything in C4.

    I've attached the spreadsheet with the original code and I would really appreciate it if you could have a look.

    If E3 and F3 are empty, when the user form is submitted the data should go to E3 but it goes to E4

    Thanks Norie I really appreciate your help!!!
    Attached Files Attached Files

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    What should I be looking at in the workbook?

    PS Why do you have +0 in frmFinance2 here?
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Norie View Post
    What should I be looking at in the workbook?

    PS Why do you have +0 in frmFinance2 here?
    Please Login or Register  to view this content.
    Hi,

    You should be looking at view business improvement tab, column C.

    The frmFinance was just what I named the userform

    Thanks!!

  9. #9
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Frankinstyyn View Post
    Hi,

    You should be looking at view business improvement tab, column C.

    The frmFinance was just what I named the userform

    Thanks!!
    Sorry, misread it.

    I was trying to mess about with codes. I think it should have been minus or plus 1

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    It should be +1, as it is in the code I posted.

  11. #11
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Norie View Post
    It should be +1, as it is in the code I posted.
    Okay, I've just changed it to +1 and now it seems to keep replacing everything in C4??

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    What is it that you want to happen exactly?

    For example what happens if there's no data in rows 2:14?

    Where would the data go then, where would it go next, where would it go after that and so on?

  13. #13
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    With this particular code, I would like it that every time the user form was submitted the data would look for the next space in column C regardless of the data in A or B.

    For example, if there was data from A3 TO A12 then I would like the data to go into C3 not C13

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    Sorry I don't quite follow.

    How can you use column C to determine where data should go in other columns?

    Do you want data to go in columns A and B until row 12 has been reached, then data goes into columns C & D until row 12 is reached and finally data goes into columns E and F?

  15. #15
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    With this particular code, I would like it that every time the user form was submitted the data would look for the next space in column C regardless of the data in A or B.

    For example, if there was data from A3 TO A12 then I would like the data to go into C3 not C13

  16. #16
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Apologies, I haven't explained things correctly.

    I have 3 user forms for that page.

    User form 1's data goes to column A
    User form 2's data goes to column B
    User form 3's data goes to column C

    The one we are working on frmFinance2, all the data should populate column C

    Hope that helps

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    Why 3 different userforms?

    Why not one userform with option buttons, or a combobox, for the user to select whether it's a new action, closing an action or completed a review?

    Whichever choice the user makes determines which column(s) the data should go in.

  18. #18
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Yeah, that was my next step i think.

    I just didn't know if what I wanted was possible?

    The idea was that someone was going to look at all of the data in one place.

    So you would recommend the multiple choice userform??

  19. #19
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform submit VBA

    Yes, it would make things a lot easier using just one form and one set of code.

    It should be straightforward too, see the attached workbook.
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    04-09-2014
    Location
    Derby
    MS-Off Ver
    Office 2013 - For my sins
    Posts
    122

    Re: Userform submit VBA

    Quote Originally Posted by Norie View Post
    Yes, it would make things a lot easier using just one form and one set of code.

    It should be straightforward too, see the attached workbook.

    That's exactly what i'll do, thanks for your help!!!

+ 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] Enforcing submit button in userform with combobox?
    By excellenthelp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2013, 01:41 PM
  2. [SOLVED] Close userform with submit button click
    By mrapes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2012, 11:53 AM
  3. comboboxes in userform, submit buttons opens outlook.
    By Jcanguy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2010, 01:42 PM
  4. How to bind CTRL-ENTER to my UserForm's submit button?
    By thornomad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2010, 01:28 PM
  5. Userform submit to Worsheet (Subscript out of range)
    By Rampage in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-05-2010, 10:26 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