+ Reply to Thread
Results 1 to 5 of 5

Match data in cells then enter date in empty cell

  1. #1
    Registered User
    Join Date
    11-07-2011
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2016
    Posts
    18

    Match data in cells then enter date in empty cell

    Ive been working on a project and finally got it somewhat working. This the timeclock fuction of the entire workbook that im needing a second head to figure out. The code i have uploaded is what i have so far which works, sort of.

    Please Login or Register  to view this content.
    This code is attached to the clockout command button and works the way it is suppose to with one exception. I need to search for the correct record before this code fires. What i mean by that is this:
    I need to search in column A to match value (the Last Name) which is contained in me.ComboBox1, I also need to check that column F of that row which contains the matched record is empty. if both matches are true, then it inserts a job code that fires the second code set. The value of the me.combobox1 could show up multiple times but only one should have an empty cell in the F column. Once the second code set fires, (inserts the job code) the current time is then inserted into the cell directly to the left of the job code. (offset(,-1)) The second code set:

    Please Login or Register  to view this content.
    You'll notice that this code set is also used when the user is clocking in. That part works fine.

    Last but not least, Ive uploaded a copy of this part of the workbook for testing. Open the workbook and click either of the buttons, the questionable code is under the ClockIn/Out button.

    Thanks in advance guys and gals for all your help.

    ** sorry, i havent had a chance to format the first code set to make it eaiser to read**
    Attached Files Attached Files
    Last edited by MyComputerGuy; 08-08-2012 at 11:42 PM. Reason: additional info

  2. #2
    Registered User
    Join Date
    11-07-2011
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2016
    Posts
    18

    Re: Match data in cells then enter date in empty cell

    *****Bump*****

  3. #3
    Registered User
    Join Date
    11-07-2011
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2016
    Posts
    18

    Re: Match data in cells then enter date in empty cell

    This must be a little more of a job than i thought it was. I listed this problem on another thread also and have not gotten an answer there either. http://www.ozgrid.com/forum/showthre...474#post622474

    If anyone has an idea that may work better but achive the same result, im open to suggestions.

  4. #4
    Registered User
    Join Date
    11-07-2011
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2016
    Posts
    18

    Re: Match data in cells then enter date in empty cell

    Just an update, I managed to figure this out on my own but decided to post the answer here for the next person that has this problem. The solution was actually very simple and i cant believe i didnt see it. In the code above you'll see a line that reads:

    iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows,SearchDirection:=xlPrevious, LookIn:=xlValues).Row

    All that was needed was to tell this line to find whatever value i was looking for. For example, in my case, all i did was to tell it to look for the value that was in Me.ComboBox1.Value So the row would look like this:

    iRow = ws.Cells.Find(What:=Me.ComboBox1.Value, SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row.

    The bold part is all that i needed to change.

    Just a word of advise here. This will only go back to the last occurance of the value so if the value occures more than once above the last row, this will only find the first occurance of it.

    Happy Codeing

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Match data in cells then enter date in empty cell

    @ MyComputerGuy

    Based on your last post it seems that you solved your issue on your own but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Thanks for posting your solution.

+ 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