+ Reply to Thread
Results 1 to 5 of 5

VBA to check for dups and sort row

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    us
    MS-Off Ver
    Excel 2003
    Posts
    42

    VBA to check for dups and sort row

    I have the below VBA code attached to a command button on a user form. The user form has two combo boxes and two text boxes. The user selects a name from combo box 5 and based on that selection, the text box called (txteuidrecord) populates with that names unique ID number that is in column "A" of each worksheet. The user selects from combo box 6 the worksheet that they want to apply this information to and then in text box "txtrecorddate", the user enters a date. Once everything has been selected and entered, the user clicks on an add button on the user form and the code selects the worksheet listed in combobox5, find the unique ID value in column "A" that's in the txteuidrecord field, and then finds the next empty cell within that row and adds the date listed in txtrecorddate. this code works great and does what I want it to do. But I need to modify it to do two more things and I am having trouble doing so.

    I would like it to first check the row for that date before it adds it, and if found, do nothing and have a message box that states "Date already on file", if not found then add the date.

    I then need it to also once the date has been added, to sort that row columns E through Z in order.


    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA to check for dups and sort row

    Hello anfdrew,

    It would be helpful if you posted the workbook. It is a good tool for checking solutions.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-20-2012
    Location
    us
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: VBA to check for dups and sort row

    I have uploaded a copy of the file. It is a work in progress still. But when it first loads, if you click on button 14 on the "Main Page" worksheet, it will show all the toolbars. I have them hidden on workbook open. For this question, if you clock on the button for "Attendance Records", that will have the "Add Record" button that this VBA code to applied to.

    While you are looking at this, I do have some issued with the View profile button and the way I currently have it setup to copy over the dates. I currently have it copying the entire row, which causes a delay which you will see if you try it. Any way to correct that?

    I probably will end up having more questions as I am very new to VBA, but I am trying to figure out a lot of things on my own before asking.

    Thanks for your help.
    Last edited by anfdrew; 07-10-2013 at 01:04 AM.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA to check for dups and sort row

    Hello anfdrew,

    I am going to need some time to make the needed changes to your code so it runs on my system. This quite an eclectic mix of code. Do you plan on running this on multiple versions of Windows?

  5. #5
    Registered User
    Join Date
    07-20-2012
    Location
    us
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: VBA to check for dups and sort row

    This file will be used on multiple computers, but all running the same version. All will be using windows 7 and have office 2010 installed on them. Thanks for any help you are able to give me. It is a lot of mixture of codes, as I am new to vba, a lot of what I have is what I have found searching around or testing myself with record macro and getting it to work.

+ 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