+ Reply to Thread
Results 1 to 5 of 5

Enterkng data on a specific worksheet using a userform command button

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    35

    Enterkng data on a specific worksheet using a userform command button

    Hello all,

    I have a combobox that is referenced to a named list 'ListReels'. There are only 8 choices (Reels 1 -8), and each has an accompanying worksheet in the workbook. The user selects a reel, then inputs other information. When an 'Enter' command button is clicked, I had like the data to be entered onto the next available row of the worksheet with the same reel name (eg, if reel 2 is selected from the combobox, then the data should be added to the Reel 2 worksheet on the next blank row.

    Thank in advance.
    Frank

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,263

    Re: Enterkng data on a specific worksheet using a userform command button

    Something like

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    01-15-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Enterkng data on a specific worksheet using a userform command button

    Hi Bernie,
    thanks for the reply.....got busy with my day job and finally getting a chance to get back at what I was doing.

    I don't think that is what I was looking for.
    Here's what I am looking for.

    1. A user form combo box has 8 items to choose from, Reel 1 to Reel 8.
    (each item in the combo box represents a worksheet with the same name).

    2. The user then enters 7 other bits of information using textboxes on the user form.

    3. Then using a command button, I want the data to be entered onto the next available
    row of the worksheet with the same name that was selected with the combo box (if the
    user selected 'Reel 2' with thecombo box, then the rest of the data on the user form
    should be entered on the next available row of the 'Reel 2' worksheet.

    I hope this makes sense.

    Frank

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,263

    Re: Enterkng data on a specific worksheet using a userform command button

    Quote Originally Posted by fbiasi View Post
    1. A user form combo box has 8 items to choose from, Reel 1 to Reel 8.
    (each item in the combo box represents a worksheet with the same name).
    me.ComboBox1.Text should return "Reel 1", "Reel 2" etc, so this should be the correct worksheet
    With Worksheets(me.ComboBox1.Text)


    2. The user then enters 7 other bits of information using textboxes on the user form.
    Thes should have the other bits, though you will need to use seven textboxes
    me.Textbox1.Text
    me.Textbox2.Text


    3. Then using a command button, I want the data to be entered onto the next available
    row of the worksheet with the same name that was selected with the combo box (if the
    user selected 'Reel 2' with thecombo box, then the rest of the data on the user form
    should be entered on the next available row of the 'Reel 2' worksheet.
    With Worksheets(me.ComboBox1.Text) 'this is the correct worksheet
    lngR = .Cells(.Rows.Count,"A").End(xlUp).Row + 1 'this finds the first empty row based on column A
    .Cells(lngR,"A").Value = me.Textbox1.Text 'this fills column A with textbox1's text
    .Cells(lngR,"B").Value = me.Textbox2.Text 'this fills column B with textbox2's text
    End With

    and continue on with .Cells(lngR,"C").Value = me.Textbox3.Text 'this fills column C with textbox3's text

    Did you try my code - put it in the commandbutton click event...
    Last edited by Bernie Deitrick; 05-28-2014 at 10:20 PM.

  5. #5
    Registered User
    Join Date
    01-15-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Enterkng data on a specific worksheet using a userform command button

    Hi Bernie,
    thank you, thank you....

    I just tried the code you sent and it works perfectly!!!

    Your explanations helped immensely. I was able to follow along with what was happening and once I modified the names of the objects, it all worked.

    Thanks again, now on to the next stage......

+ 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. Need a single command button to display data from 2 Sheets in a UserForm
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2013, 05:30 PM
  2. [SOLVED] getting data from command button in userform why is my code not working?
    By Curious2 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-07-2013, 10:37 AM
  3. Using a worksheet command button to start userform initialize procedures
    By paulary30 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-21-2012, 12:25 PM
  4. Command button code to write to worksheet and then open userform
    By Reidm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2008, 10:33 AM
  5. Specifying a Command Button on a worksheet as differentiated from one on a UserForm
    By Amber_D_Laws in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-07-2006, 11:43 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