+ Reply to Thread
Results 1 to 24 of 24

Formula Problem - Help needed to autofill Userform if Data exists

  1. #1
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Formula Problem - Help needed to autofill Userform if Data exists

    Hello,

    I have the Userform that is complete and it adds a record at the end of the table as designed -yet it would be nice if the Userform could auto populate the form with existing Employee Data if it already is there!

    Below is a copy of the Userform code

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

    Best Regards,

    John
    Last edited by JJFletcher; 10-24-2014 at 11:33 AM. Reason: Wrong Title Descriptiion

  2. #2
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Is this question in the right Posted Area?

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    It's posted in the right area as far as i know.

    Here's some code, be sure this is in your EmployeeData worksheet. It should be easy to extrapolate for the rest of your values.

    Please Login or Register  to view this content.
    Edit: Re-reading your post, I'm confused. Your text makes it sound like you want to go from worksheet to user form, whereas your code looks like you want to go from values on the userform to cells in the worksheet. Either way, the code above does the former, the code below does the latter:

    Please Login or Register  to view this content.
    Etc. Etc.
    Last edited by walruseggman; 10-24-2014 at 12:28 PM.

  4. #4
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    You are accurate in the need of the Userform... The issue was that the way that the Userform was created it enters data into the EmployeeData spreadsheet and adds the data to the bottom of the sheet (Works Great). The issue is that when you use the Userform to update data on the EmployeeData spreadsheet this Userform does not do it - only addes to the bottom of the sheet next row available.

    The code you suggested does not work...

    Please Login or Register  to view this content.
    Have you a suggestion?

    John

  5. #5
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    HR Dashboard ME V5.xlsm

    I have attached my Project for review

    The form works well when adding a record - I would also like to use the same form to Update or edit current data in the EmployeeData worksheet.

    Can the code be modified to accomplish this

    Best Regards,

    John

  6. #6
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    HR Dashboard ME.xlsm

    I think this version will allow access into the code

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    The code you posted doesn't work because address is a string. The code runs because you're comparing the Target Address to another string: "$A$2:$A$98" et.al. But those are not ranges (as I suspect you had wanted them to be), just strings of characters.

    Instead, you could try something like:

    Please Login or Register  to view this content.
    If you're still having issues, I'll take a look at your workbook.

  8. #8
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Hi -

    I have tried to understand your last post - I am sorry I am not an accomplished coder!

    I have attached my Project for review

    The form works well when adding a record - I would also like to use the same form to Update or edit current data in the EmployeeData worksheet.

    Can the code be modified to accomplish this - if you do review - please use the last poste workbook

    John

  9. #9
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    This is what I put into the EmployeeData sheet

    Please Login or Register  to view this content.
    It did not populate any data into the fids of the Userform from the EmployeeData sheet

    I am lost for sure!

    JOhn

  10. #10
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Tried this and it did not work either:

    Please Login or Register  to view this content.



    John

  11. #11
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Target.Column is a number, specifically a Long, as I had implied in my example. Target.Column will never equal "A", regardless of what you are doing. Try the columns a numbers instead of letters (where A = 1 and Z = 26), and in the meantime I will try to look at your workbook.

    If this is too confusing, put a breakpoint in the first line of your code (click to the left of it in the grey bar; a red dot will appear). Run the code, then step through it (F8) line by line. Either hover over some of your variables, or set watches by highlighting and hitting Shift+F9.

    This should hopefully help you gain a better understanding of what the vaiable types are and what you can be checking for in your If statements.

  12. #12
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    I made what I thought you meant - did not work

    Please Login or Register  to view this content.
    I am still trying!

  13. #13
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Thanks for looking at the workbook Walruseggman

    I really appreciate it

  14. #14
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Thanks for looking at the workbook Walruseddman

    I must think you are somewhat annoyed with folks like me trying to accomplish this with no experience at all...

    I really appreciate it

  15. #15
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Would like to generate a new set of eyes on this... I have applied the code as Walruseggman showed - yet the Userform will not ley me modify or edit the records that are already in the sheet - it only allows me to add: - Any Idesa?

    Please Login or Register  to view this content.
    Thanks

    John

  16. #16
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Would like to generate a new set of eyes on this... I have applied the code as Walruseggman showed - yet the Userform will not ley me modify or edit the records that are already in the sheet - it only allows me to add: - Any Idesa?

    Please Login or Register  to view this content.
    Thanks

    John

  17. #17
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    These are the errors I am getting when adding the previous post code to the EmployeeData sheet in VBA:

    error1.JPGerror2.JPG

    Any Ideas?

    John

  18. #18
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    I'm not giving up on you, I just haven't had time to look at your workbook. At this point, I don't think fresh eyes are needed, because you still have some basic syntactical errors that are preventing your code from running the way you desire.

    Don't put you Row and Column numbers in quotes. They are actual numbers, not strings.

    Also, double check that the name of your user form is actually UserForm. (View-->Properties)

  19. #19
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Thanks Walruseggman,

    I thought you were gone!

    The name of the Userform is indeed Userform not Userform1

    The following code is accurate?

    Please Login or Register  to view this content.
    The above code does actually nothing!
    Last edited by JJFletcher; 10-25-2014 at 10:14 AM. Reason: additonal comment to add

  20. #20
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    I don't know where you got Excel.Address, but address is just a string, not an object. As such, it won't have properties like .Row and .Column.

    You need to be passing in an object, which in this instance would be Range.

    I'm on a tablet for now and can run any code, but I'm happy to keep helping you with issues like this in the meantime.

  21. #21
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Sorry - Don't know how Range got changed to Address - does that impact your code?

    Is this correct? - because the data from the sheet does not populate the Userform - I can add a record to the sheet - but does not allow editing of the records in the EmployeeData spreadsheet

    Please Login or Register  to view this content.
    Thanks,

    John

  22. #22
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    I'll be on my computer in a few hours. Let me try to run the code then

  23. #23
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    985

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    Thanks,

    I really appreciate your help!

  24. #24
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Formula Problem - Help needed to autofill Userform if Data exists

    So, in the last workbook you posted, the name of your user form is not "UserForm", as you had said. It's "frmCustInfo". This makes all the difference. So changing that, along with a few typos in your field names, the following code works just fine for me:

    Please Login or Register  to view this content.

+ 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. How to get data entered in a form to auto populate into a calendar?
    By JMAE1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2014, 02:31 PM
  2. Auto Populate Form With Selected Email In VBA Userform
    By Jeffrey34 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2014, 07:56 AM
  3. Auto populate vacation calendar dates per employee
    By boxermack in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-17-2013, 11:47 AM
  4. [SOLVED] How to auto-populate userform with appropriate data from spreadhseet
    By dheads in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2012, 04:38 PM
  5. [SOLVED] How to auto populate an invoice from data in an existing worksheet
    By juliebythesea in forum Excel General
    Replies: 4
    Last Post: 07-14-2006, 05:40 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