+ Reply to Thread
Results 1 to 18 of 18

User Form not adding data

  1. #1
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    User Form not adding data

    I made a user form to enter the data but I cannot get the data to copy to the worksheet.

    The worksheet is named "WOODS" and the data should be entered in the first available blank row, starting with column "B".

    Here is he code I tried but as of yet when I try to run the code nothing happens.

    Please Login or Register  to view this content.
    Any help would be wonderful.

    Jim O
    Last edited by JO505; 02-05-2013 at 06:14 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    This is a stupid question but is the code actually running when you click the button?

    Plenty of times I've renamed a button but not the sub and wondered why the code in it's click event wasn't working.

    To check put a breakpoint on the first line of the sub, run the userfom and click the button.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: User Form not adding data

    Remove end if and then try.

    Thanks

    Thameem

  4. #4
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    Norie,

    You are talking way over my head. I am a real novice when it comes to code. Could you explain that in other terms?

    I created the form and added a Command Button (#1). I then copied the code from another file and I thought I made the proper corrections obviously I didn't.

    What is a break point, how do I create one and how do I use it?

    Thanks,

    Jim O
    Last edited by JO505; 02-05-2013 at 01:23 PM. Reason: SP

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Jim

    All I was saying is that if you've renamed the command button then the code might not run.

    What happens if you double click on the button when the form is in design view?

    PS To set a breakpoint you select a line of code and press F9.

  6. #6
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    I think I set a breakpoint, an icon came up in the code when I pressed F9, and still nothing happened.

    In design view the button brings up the code.

    Jim O

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Jim

    Can you attach the workbook?

  8. #8
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: User Form not adding data

    @ Jim

    Did you test after removing end if statement from this code

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    Here is a sample of the work sheet I want to copy the data to, the actual file has over 2000 rows. I don't know how to copy a user form so if you need that as well let me know and I will create a sample. I just want to have a user form for easier data entry. Column "A" is a formula that in a pinch I can just drag to copy.

    Jim O
    Attached Files Attached Files

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Jim

    To copy the userform.

    1 Open the workbook the form is in and the workbook you want to copy it to.

    2 Open the VBE with ALT+F11.

    3 In the Project Explorer on the left locate the userform.

    4 Drag the userform into the workbok you want to copy it to.

    5 Close and save the workbook you copied the form to.

  11. #11
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    See if this works any better.

    Jim O
    Attached Files Attached Files

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Jim

    Still no userform.

  13. #13
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    Lets try again.
    Attached Files Attached Files

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Data is being added, but not directly under the existing data.

    The reason for that is that you have filled the fomula down in column A which is the column you are using to find the next row.

    What you could do is delete the formulas in the rows with no data, or change the column used to find the next row to column B.

    It's probably best to delete the formulas and add to the code so the formula is copied down when new data is added.
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    Nori,

    Thank you for your input. It is now working but the formulas are not showing up. They are their I can see them if I click on the cell but I cannot get them to display. I have tried various format settings but then don't show up. All other values display in black text but not the formula.

    Jim O

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: User Form not adding data

    Jim

    Your code as it is doesn't fill in column F.

    The first part of the formula checks if F is empty and returns "" if it is.

    As soon as you fill in column F the formula will return a value

  17. #17
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Central Ohio
    MS-Off Ver
    Excel 2000, and 2010
    Posts
    654

    Re: User Form not adding data

    Dont know what happened but it is working fine now.

    Norie, thank you very much for you time and input with this.

    Jim O

  18. #18
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: User Form not adding data

    Shaft Data.xlsmTry this.

    Basically what I did was just rewrite your formula in column A. The yellow line is where I changed your formula and then I dragged down.

    I just changed it to look at the B cell instead of the F cell.

    Hope this helps you out.

    Thank you.
    Last edited by whatsmyname; 02-07-2013 at 01:25 PM.

+ 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