+ Reply to Thread
Results 1 to 5 of 5

Transfer data from UserForm to Specific Sheet...

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2007
    Posts
    89

    Transfer data from UserForm to Specific Sheet...

    Hi,


    I have got a UserForm from where data is transfer to different worksheets based on "Year" selected from Userform.

    e.g there are 4 worksheets name (2010, 2011, 2012 ,2013).

    In the UserForm I have 3 textboxs and 1 comboBox. ComboBox shows years (2010,2011,2012 & 2013)

    From the Userform when Year "2010" is selected and fill the remaing text boxes and when press "Add Data" button....the data goes into Sheet 2010.

    From the Userform when Year "2011" is selected and fill the remaing text boxes when press "Add Data"button..the data goes inot Sheet 2011.

    This all working perfect.

    But I want to replace the ComboBox (Years) with the check boxes..
    I do not want to use ComboBox for showing "Years" ..I want CheckBoxes

    e.g checkbox1 = 2010, checkbox2 = 2011, checkbox3 = 2012, checkbox4 = 2013

    I want when checkbox1 is slected the data should go into Sheet 2010......and when checkbox2 is selected the data should go into Sheet 2011...and so on.....


    Here is code ( worksheet is also attached )

    Please Login or Register  to view this content.
    I would be very thankful If anyone could help me please.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Why do you want to replace the combobox with the checkboxes?

    It can be done but it would complicate things a little.

    Also, what would/should happen in more than one checkbox is checked?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Transfer data from UserForm to Specific Sheet...

    Hi Norie..

    Actually I need check boxes on my UserForm

    Is it possible that when One checkbox is selected the other remianing checkboxes should be disable OR when more than one checkboxes are selected the UserForm should not transfer the data to worksheet and should display a message e.g "Please Select only one CheckBox "


    Can you please write such a code by editing the above code .....

    I would be very thankful to you..


    Best Regards
    z-eighty2

  4. #4
    Registered User
    Join Date
    07-04-2013
    Location
    LONDON
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Transfer data from UserForm to Specific Sheet...

    Hi, sorry for interupting your post but I want to ask some question about the update function of your userform.

    I have a userform and I am using it for searching the product information from my excel database. And now I want to add an update function for this userform.From my userform, if I enter the item code and press the search button, then the useform will find and display all the info of that item. And if I want to create another button call'Update', for updating the data I typed in after searching the old data. I don't know how to link the updated data to the original cell, can I use your code for my purpose?

    Here is the code I write and the useform I use
    "Private Sub TextBox1_AfterUpdate()

    Dim sFind As String, rFound As Range


    If Me.TextBox1 = vbNullString Then Exit Sub
    sFind = Me.TextBox1.Value

    With Sheet1
    Set rFound = .Columns("A:A").Find(what:=sFind, after:=.Cells(1, 1), LookIn:=xlValues, lookat:=xlWhole, _
    searchorder:=xlByRows, searchdirection:=xlNext)

    If Not rFound Is Nothing Then
    With Me
    .TextBox2 = rFound.Offset(0, 1)
    .TextBox3 = rFound.Offset(0, 2)
    .TextBox4 = rFound.Offset(0, 3)
    .TextBox5 = rFound.Offset(0, 4)
    .TextBox6 = rFound.Offset(0, 5)
    .TextBox7 = rFound.Offset(0, 6)
    .TextBox8 = rFound.Offset(0, 7)
    .TextBox9 = rFound.Offset(0, 8)
    .TextBox10 = rFound.Offset(0, 9)
    .TextBox11 = rFound.Offset(0, 10)
    .TextBox12 = rFound.Offset(0, 16)
    .TextBox13 = rFound.Offset(0, 17)
    .TextBox14 = rFound.Offset(0, 18)
    .TextBox15 = rFound.Offset(0, 19)
    .TextBox16 = rFound.Offset(0, 20)
    .TextBox17 = rFound.Offset(0, 21)
    .TextBox18 = rFound.Offset(0, 22)
    .TextBox19 = rFound.Offset(0, 23)
    .TextBox20 = rFound.Offset(0, 24)
    .TextBox21 = rFound.Offset(0, 25)
    .TextBox22 = rFound.Offset(0, 26)
    .TextBox23 = rFound.Offset(0, 27)
    .TextBox24 = rFound.Offset(0, 28)
    .TextBox25 = rFound.Offset(0, 29)
    .TextBox26 = rFound.Offset(0, 30)
    .TextBox27 = rFound.Offset(0, 31)
    .TextBox28 = rFound.Offset(0, 32)
    .TextBox29 = rFound.Offset(0, 33)
    .TextBox30 = rFound.Offset(0, 34)

    End With
    Else
    MsgBox "Record not found"
    End If
    End With

    End Sub"



    userform.PNG

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Transfer data from UserForm to Specific Sheet...

    @z-eighty2

    Perhaps option buttons instead of checkboxes? Option buttons won't let you select more than one if they are set up right.

    @yontyont

    Please start a new thread and post your questions there.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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