+ Reply to Thread
Results 1 to 3 of 3

Filling up my selected worksheet with data from my userform

  1. #1
    Registered User
    Join Date
    03-10-2017
    Location
    Holland
    MS-Off Ver
    Office 2016
    Posts
    14

    Filling up my selected worksheet with data from my userform

    Hello all,

    my name is Stefan and im very very new with VBA,

    i managed to make a new Worksheet by clicking on the cmdbutton and give it the same name as in textbox1

    but now i want the data from textbox2 and textbox3 in the newly maked worksheet

    can somebody please help me.

    this is the code for making my new worksheet:


    Private Sub cmdVogelOpslaan_Click()

    'create new worksheet with name
    Worksheets(1).Select
    Dim strNewName As String
    Dim ws As Worksheet
    Dim boolFound As Boolean
    'pull sheet name from Textbox1
    strNewName = txtNaam.Value
    For Each ws In Worksheets
    If ws.Name Like strNewName Then boolFound = True: Exit For
    Next
    'If sheet already exists
    If boolFound = True Then
    MsgBox ("Sheet already exists, please enter a new name or click on Cancel to close")
    'If sheet does not already exist, add sheet
    Else
    Sheets.Add.Name = strNewName
    'move worksheet to second sheet on list
    Worksheets(1).Move Before:=Sheets(3)

    'close userform if sheet added
    Unload Me
    End If
    'userform still active if sheet not added
    End Sub


  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Filling up my selected worksheet with data from my userform

    Hi and welcome to the forum.

    Change the cell address to where you want to put the textbox text.

    Please Login or Register  to view this content.

    See my signature block below about the use of CODE tags. It's a forum rule. Please edit your original post and add the tags.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    03-10-2017
    Location
    Holland
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Filling up my selected worksheet with data from my userform

    Thx AlphaFrog for the quick support.

    it worked!

+ 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] Userform Listbox selected data transferred to a Worksheet cell
    By Tony Hadj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2014, 02:51 AM
  2. [SOLVED] Combo Box list filling and export the selected data to another worksheet
    By Sailaja A in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2014, 11:59 AM
  3. How to set up a userform to direct inputed data to a selected row in a worksheet
    By AnthonyJones in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2012, 03:49 AM
  4. Display a UserForm based on Data selected in another UserForm's ListBox
    By RPhilbin83 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-26-2011, 11:35 AM
  5. VBA to close a userform when a different worksheet is selected
    By Barking_Mad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2010, 06:29 AM
  6. Filling in cells with user selected data
    By Raggy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-29-2008, 04:52 PM
  7. Activating userform and filling it with data form row where userform is activate
    By Marthijn Beusekom via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2005, 01:06 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