+ Reply to Thread
Results 1 to 15 of 15

VBA Userform Data Entry - Reference Number problem

  1. #1
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    VBA Userform Data Entry - Reference Number problem

    Hi Guys,

    Me again and I have another problem I cannot seem to work my way around.

    I have a userform that will allow the user to enter in new data, however, the first column in the sheet where the data is contains reference numbers.

    I need the userform entry TextBox1 to be last reference number in the sheet +1 so that each new entry gets the next reference number in the line.

    So Column A Row 2 has the reference TestRef1, I need the userform to state in TextBox1: TestRef2 and so on...

    Please help me as this is for a project that I am working on.

    Thanks!
    Last edited by TalResha; 06-17-2011 at 09:38 AM.

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: VBA Userform Data Entry - Reference Number problem

    try solution from attached file

    Best Regards
    Attached Files Attached Files

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    Please help us by posting a sample workbook, illustrating your question.



  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    @Maczaq,

    This suffices: (no need for Textbox1)

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: VBA Userform Data Entry - Reference Number problem

    @snb

    thanks for showing me other way.
    Works great, and I will consider to use this kind of output data back to sheets in my projects

    Good bless You !

  6. #6
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    Re: VBA Userform Data Entry - Reference Number problem

    Keep getting a type mismatch:

    .Offset(1).Resize(, 2) = Array(.Value + 1, TextBox2.Text)

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    Re: VBA Userform Data Entry - Reference Number problem

    Hi snb,

    Still the same error, not sure what is going on here...

    It might be because I have two userforms, one is where the user selects input new site, and then the input new site userform pops out.

    Also, the sheet I need to pull the reference data from is called Details and for some reason I cannot call that sheet up through this code..

    HEEELP!!!

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    Please don't yell but post a sample workbook instead....

  10. #10
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    Re: VBA Userform Data Entry - Reference Number problem

    Hi snb,

    Wasnt yelling, sorry about that, forgot that CAPS in forums mean yelling

    Find attached a sample workbook.

    This is much more simplified from what I am working on, but should cover what I am trying to do with this part of the code.

    The details sheet is hidden, and column A has the references.

    Thanks for all of your input and for all your help in this
    Attached Files Attached Files

  11. #11
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    I never heard someone whispering 'help'.

  12. #12
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    Re: VBA Userform Data Entry - Reference Number problem

    Hahahaha, true

    Hopefully the sample workbook will aid you in your quest to help me

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    What's the point in repeating "Ref_" ? while the column label is data_reference ?

    If you like to keep this you can use the numberformatting "Ref_"0000
    Now the content of the cell will be 1,2,3,4,5, etc., but is will be shown as "Ref_0001", "Ref_0002", etc.

  14. #14
    Registered User
    Join Date
    01-06-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    39

    Re: VBA Userform Data Entry - Reference Number problem

    Hi snb,

    Again, thank you for your input, however, the Ref needs to stay there as this data is then migrated into other sheets for reporting purposes. I know it is a bit of pain but

    If you can set it up like you explained above that sounds good as I am not too sure how that would work

    Again, your input in this is greatly appreciated

  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Userform Data Entry - Reference Number problem

    Using the explanation you will be able to implement this yourself.

+ 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