+ Reply to Thread
Results 1 to 20 of 20

VB Write User Form Data to Excel

  1. #1
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    VB Write User Form Data to Excel

    Hi All,

    I have a code below to write the data completed in a user form to excel but it is not working, can anyone see what the problem is with it at all. Also doe anyone know how I can link to a PDF document through the userform?

    Please Login or Register  to view this content.
    I would apprcaite anyones help.

    Shazz
    Last edited by Shazz; 01-25-2012 at 12:35 PM. Reason: adding more text

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: VB Write User Form Data to Excel

    IN this line, .Parent is unqualified, you haven't set the range
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    Sorry I may sound a bit thick, but not sure what I need to do, I am using this code in another sheet and it works fine??

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    In the other sheet you must have a With range(...) type statement which is not present here as Kyle said. Change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    Good luck.

  5. #5
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    It is still not working unfortunately, I am still getting an error, I have attached my workbook, could you have a look for me and see where I am going wrong.

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    You don't have a sheet called Sheet1!

  7. #7
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    Ops, sorry your right, how did I miss that lol.

    A couple of questions for you, can you use links within a User Form, i want to be able to click on a link in the userform that will go direct to a PDF Form outside of excel, also is there a way of viewing the data within the userform as well as on the Excel Sheet, and have Find record, First, Last, Next Record like in Access??

    Thanks for your help.

    Shazz

  8. #8
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    When I add data to the form it keeps overiding the same row all the time, do i need to add to the code so that each new data go into the next row?

    Shazz

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    Try

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    No this now flags up an error on the "RowCount = .Cells(.Rows.Count, 1).End(xlUp).Row - .Row + 1"


    Please Login or Register  to view this content.

  11. #11
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    My mistake - remove the
    Please Login or Register  to view this content.
    part.

  12. #12
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    Ok done that, now the error comes up at .Offset(RowCount, 0).Value = Me.TextBox1.Value

    Shazz

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    That is not in the code I posted?

  14. #14
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    It is still showing an error

    Please Login or Register  to view this content.
    Last edited by Shazz; 01-26-2012 at 06:55 AM. Reason: Changed Code

  15. #15
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    What error?

  16. #16
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Re: VB Write User Form Data to Excel

    I have now managed to sort it out, sorry for all the bother.

    Could you advise if I am able to use the user form like excel and view the records from the userform and not the spreadsheet, with buttons like next Record, first, search fro Record etc.

    Thanks you in advance xx

    Shazz

  17. #17
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB Write User Form Data to Excel

    Yes but only if you add those buttons and the appropriate code. You may want to look at the built-in data form (if you have not already) or John Walkenbach's Data Form add-in.

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: VB Write User Form Data to Excel

    Do you have a "Textbox1" looks like it should be:
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Smile Re: VB Write User Form Data to Excel

    Sorry Kyle not sure what you mean by this?


    Do you have a "Textbox1" looks like it should be:
    Code:
    Me.TxtLocation.value
    I am very new to User Forms, does anyone have any examples that can show how to go about using it for view Data as well as entering data, I also need to know how I can enter a hyperlink in a user form too.

    Thanks
    Shazz

  20. #20
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Halstead
    MS-Off Ver
    Excel 365
    Posts
    240

    Smile Re: VB Write User Form Data to Excel

    Sorry Kyle not sure what you mean by this?


    Do you have a "Textbox1" looks like it should be:
    Code:
    Me.TxtLocation.value
    I am very new to User Forms, does anyone have any examples that can show how to go about using it for view Data as well as entering data, I also need to know how I can enter a hyperlink in a user form too.

    How do you look at the Built in Data Form

    Thanks
    Shazz

+ 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