+ Reply to Thread
Results 1 to 7 of 7

VBA to insert userform information into columns

  1. #1
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    VBA to insert userform information into columns

    Hi,

    I actually already asked this one before, but the response was good; I should have mentioned I'm a beginner on Macro's, so I didn't completely understand it.

    I have a UserForm that has a mix of ComboBox and TextBox options. Once all fields are filled out, I have a command button (this is where I need the macro) so that when you click on this button, the options are filled out across the columns of a separate spreadsheet. I'd like this to continually happen, every time a new form is filled out, I want the information to appear in the next empty row down.

    I won't write down all the options, but just a few examples:
    (The first empty row is row 3)

    ComboBox1 = Data enters into Column B
    ComboBox2 = Data enters into Column C
    ComboBox3 = Data enters into Column D
    TextBox1 = Data enters into Column E
    TextBox2 = Data enters into Column F
    ComboBox4 = Data enters into Column G

    As so on and so forth, lets say all the way up to TextBox8 = Data enters into Column M. All the data doesn't get input into the columns until the command button is clicked.

    There are no dates, times, expenses etc, all information is only text, so no special extra codes needed.

    Is there a really really easy VBA code someone could send me to copy and paste and all i need to do is arrange the above ComboBox and TextBox into the correct columns? I would be great appreciative. Someone was able to provide me a macro once before for something similar, unfortunately I no longer have it.

    Thank you

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VBA to insert userform information into columns

    I used a public control array. I would normally set the Tag property for those controls manually. Here, I did it for you.

    I also commented how to do it more "simply" should you want to use that method istead. Button2 shows how you can iterate the control array and do whatever you like, like clear the contents easily.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: VBA to insert userform information into columns

    Thanks Kenneth. That didn't work unfortunately but not to worry. I'll just set up a basic spreadsheet where staff can just type everything in the cells instead.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,294

    Re: VBA to insert userform information into columns

    Or something like this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: VBA to insert userform information into columns

    That's fantastic bakerman2, thank you so much!

  6. #6
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: VBA to insert userform information into columns

    Sorry, one last thing. What can I add to that so that once the commandbutton is clicked and everything is inserted, it then clears all the fields?

  7. #7
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: VBA to insert userform information into columns

    All good, figured it out, thanks again!

+ 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] Insert Information from UserForm into spreadsheet rows
    By Anarchus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2016, 01:30 AM
  2. Replies: 7
    Last Post: 06-16-2016, 08:54 AM
  3. Macro to insert userform information into rows
    By Cremorneguy in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-29-2015, 09:01 PM
  4. [SOLVED] Information from userform overwriting data previously entered by same userform
    By ciresuark in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-20-2015, 02:10 PM
  5. Replies: 2
    Last Post: 12-26-2012, 05:10 AM
  6. Replies: 6
    Last Post: 11-22-2012, 09:56 AM
  7. Replies: 1
    Last Post: 09-05-2012, 04:11 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