+ Reply to Thread
Results 1 to 24 of 24

User Form

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    User Form

    Hi respected Excellers!

    First of all I want to tell that I am not a programmer but the following application I need to develop because it will make my work easy as I have much more data to enter and the fields are too many


    I have a table in a sheet.My table's first row contains headings(15 fields).I have created a user form that consists of the labels and text boxes,for some fields combo boxes. and then there are command buttons name "send data to sheet", "Quit"button ,"clear", Last Record","First Record","Find Record"
    What code should I write in a way that after filling the last field for one record it should start from the next row for a new record.
    What would be the codes for my last command buttons? I know how to change the names and captions of the forms items in the property boxes.

    also please suggest me some links for user form DESIGNING.

    I think it is the longest question but I hope you will help me.I am ready to further explain if it is not understandable.

    Best Regards
    Excelisfun

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: User Form

    First post example file with table sheet and userform so we know what we're dealing with.

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Thanks bakerman for reply.here is the sample file
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: User Form

    At first you should try this
    This is built in solution in excel to simply enter data through a form.
    I think you should try this at first.

    https://support.office.com/en-us/Art...3-291fc03e4d77

    Click on link and follow
    Don't wait for the PERFECT MOMENT
    take the moment and make it PERFECT
    Amir

  5. #5
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    is this roughly what you want
    cheers
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    this loads the userform (look in workbook) and unloads with close form ,clear form now clears the first 3 boxes
    cheers colin
    Attached Files Attached Files
    Last edited by cfinch100; 09-15-2015 at 03:09 PM.

  7. #7
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Well here is a completed form.there is a sheet "MasterTable".The should be trasferred to that sheet in the table there in. I have Written the code to load the form from that sheet "mastertable".and also found the code to make the form go away.Rest of the codes are needed.The fields having comboxes I have managed by putting the row source in the properties.

    I would be grateful to the forum and its members if I got this sheet work the way I wanted.Thanks for your time.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    why have you taken out what I had given you it was a starting point for you
    colin

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: User Form

    Let's start with this.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: User Form

    Hi bakerman2
    Please Login or Register  to view this content.
    is not working....

  11. #11
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: User Form

    And I think at start we prefer to save .xlsm workbook.
    It's easy to understand the macro.

    The guy (Imran) started this thread is still saving .xls workbook and using Excel 2013.
    How is it possible?

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: User Form

    @ Amirsoft

    Don't say it's not working if you havent' tried filling in all fields.
    Then you would see it works perfectly.

  13. #13
    Forum Contributor Potholes's Avatar
    Join Date
    11-25-2011
    Location
    Brisbane
    MS-Off Ver
    Office 2021
    Posts
    774

    Re: User Form

    Quote Originally Posted by bakerman2 View Post
    Let's start with this.
    Good Evening

    Did you get my PM earlier today.

    Potholes

  14. #14
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: User Form

    Thanks bakerman2

    But you know there is a possibility of empty control. Maybe any information is late or Not Available and temporary we have to left that control empty.

    That's why I was saying.

    The guy who posted this thread do not know much about the vba. So we should start from initial stage.

    And he should start from simple forms then he can learn easily.

  15. #15
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Hi respected members and moderators! I just logged in and saw many reply to my thread. Thanks to all for your time and I will write again after reading your replies and downloading the sheets and trying the same. I felt a quick reply/thanks a MUST.

    Regards

  16. #16
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Hello again! I have written the rest of the code according to your guide lines.The problem with "Send Data to sheet" command button code that I have edited and put my references there. It does sends the data to sheet but leaves first 3 rows empty.I don't know whats wrong with the code or is it my mistake to edit it. the sheet is again attached.

    @bakerman and clon! your codes are used .
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    see if this helps you a bit the 5 at the end of the line is the row number you want to start on
    cheers colin
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Now I have got many things only one problem left then I will mark this thread as SOLVED.Problem is that my userform although transferring data to worksheet but in the beginning it left one row.For your kind review the sheet is again attached.I tried repeatedly by subtracting the number of lines upward of my MasterTable .but still it left the first row of the table as blank.Nothing dangrious but it looks odd when viewing the table.

    looking forward your kind suggestions
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    refer to previous one I sent you can move to the row by changing + 5 is that what you are wanting ,to begin at the start
    cheers colin

  20. #20
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Here is my code for "Add data to worksheet". colin how can I insert your specific lines of code to this coz when I did the same it produces some errors perhaps the variables are declared differently in both codes.

    Private Sub cmdAdd_Click()
    Dim lngWriteRow As Long

    Dim ws As Worksheet
    Set ws = Worksheets("MasterTable")

    lngWriteRow = ws.Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0).Row


    If lngWriteRow < -8 Then lngWriteRow = -8



    ws.Range("a" & lngWriteRow) = txtSrNo.Value
    ws.Range("b" & lngWriteRow) = txtName.Value
    ws.Range("c" & lngWriteRow) = txtFGN.Value
    ws.Range("d" & lngWriteRow) = cbCat.Value
    ws.Range("e" & lngWriteRow) = cbRlgn.Value
    ws.Range("f" & lngWriteRow) = txtDOB.Value
    ws.Range("g" & lngWriteRow) = txtAppDate.Value
    ws.Range("h" & lngWriteRow) = cbCStts.Value
    ws.Range("i" & lngWriteRow) = txtDAdmn.Value
    ws.Range("j" & lngWriteRow) = txtAdmnNo.Value
    ws.Range("k" & lngWriteRow) = cbClss.Value
    ws.Range("l" & lngWriteRow) = cbSection.Value
    ws.Range("n" & lngWriteRow) = txtAddress.Value
    ws.Range("o" & lngWriteRow) = txtContact.Value

    If Me.CBShaheed.Value = True Then
    ws.Range("p" & lngWriteRow).Value = "Yes"
    Else
    ws.Range("p" & lngWriteRow).Value = "No"
    End If

    If OBRtd.Value = True Then
    ws.Range("m" & lngWriteRow) = "Retired"
    Else
    ws.Range("m" & lngWriteRow) = "Serving"
    End If
    End Sub

  21. #21
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi

    as far as I know there is no easy way just re write your code with
    Please Login or Register  to view this content.
    bit more work for you but it works have done some for you
    cheers colin
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    hi
    nearly complete just got to do option buttons,heres a start

    Please Login or Register  to view this content.
    cheers
    Attached Files Attached Files
    Last edited by cfinch100; 09-21-2015 at 02:50 PM.

  23. #23
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: User Form

    Finally I have got what I wanted my User form to perform at first stage. It was possible due to your interest in the thread.Thanks a lot to forum members and moderators. Attached is the sheet with the code I was able to write with the help of your suggestions.The thread is SOLVED.But its not my last thread.

    Best Regards
    Imran Bhatti
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: User Form

    pleased to 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] User-Form Problem: User can select headers in User Form (I want Header/no way to select)
    By navialivad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2014, 10:24 AM
  2. how can i give a link to one user form to anther user form
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2014, 07:37 PM
  3. [SOLVED] User Form to execute search and return all values to the user form for editing
    By allwrighty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 10:40 PM
  4. [SOLVED] Excel vba user form- open directly to user form not worksheet
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-24-2013, 05:07 PM
  5. [SOLVED] Excel user form- If/Then statement outcome to show on user form
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 09:16 AM
  6. Print preview from user form opened from a user form
    By Brunstgnegg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2011, 05:12 AM
  7. Filling form fields via worksheet dropdowns, user update via form, change form color
    By Demosthenes&Locke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 08:58 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