Results 1 to 8 of 8

Find specific data combination on another sheet using command button.

Threaded View

Ataraxicatom Find specific data... 09-07-2012, 01:06 PM
jaslake Re: Find specific data... 09-07-2012, 02:07 PM
Ataraxicatom Re: Find specific data... 09-07-2012, 03:40 PM
Ataraxicatom Re: Find specific data... 09-07-2012, 04:22 PM
jaslake Re: Find specific data... 09-07-2012, 05:11 PM
Ataraxicatom Re: Find specific data... 09-07-2012, 06:12 PM
jaslake Re: Find specific data... 09-07-2012, 07:59 PM
Ataraxicatom Re: Find specific data... 09-08-2012, 09:55 AM
  1. #1
    Registered User
    Join Date
    07-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    57

    Find specific data combination on another sheet using command button.

    Hello,

    I have been working on something for a while now and I've hit a brick wall. I have a command button that I need to add functionality to. It needs to search a different sheet for a name/date combination. I know how to search for 1 at a time, but not both. Or make it search from the bottom going up. That would work for me as well. Then I could just find the last entry of the name and check the date on it. If you look at the sheet, you will see what I am working with. Basically, the button checks the cells to make sure data is entered, then it adds the pertinent data to the other sheet. I would like to have it check to see if the data is already there. Since the names will come up more than once, I cannot just search for that and since there will be multiple people per day, I cant search by date either, it has to be both.

    Here is the code for the button:
    Sub Main2()
    
    Dim MyRow As Integer
    MyRow = ActiveSheet.Shapes(Application.Caller).TopLeftCell.Row
    Dim LastRow As Integer
    LastRow = Sheets("Log").Range("A" & Rows.Count).End(xlUp).Row
    
    If Sheets("A-M").Cells(MyRow, 3).Value = 0 Or Sheets("A-M").Cells(MyRow, 4).Value = 0 Then
    MsgBox "Please fill in all of the fields.", vbCritical, "Cancelled"
    Else
    
    Sheets("Log").Activate
    Sheets("Log").Cells(LastRow + 1, 1).Value = Sheets("A-M").Cells(MyRow, 1).Value
    Sheets("Log").Cells(LastRow + 1, 3).Value = Sheets("A-M").Cells(MyRow, 3).Value
    Sheets("Log").Cells(LastRow + 1, 4).Value = Sheets("A-M").Cells(MyRow, 4).Value
    Sheets("Log").Cells(LastRow + 1, 2).Value = Format(Now, "MM/DD/YY")
    Cells(LastRow + 1, 1).Select
    Sheets("A-M").Cells(MyRow, 3).ClearContents
    Sheets("A-M").Cells(MyRow, 4).ClearContents
    
    End If
    End Sub
    Oh! and it's a location based dynamic button. It takes a value from the row it is on for most of the calculations and data transfer. The button can exist on any row on the sheet... makes it idiot proof... Kinda.

    Any help would be appreciated.
    Attached Files Attached Files

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