Results 1 to 2 of 2

Searching for values using textbook in userform and populating spreadsheet with the row

Threaded View

  1. #1
    Registered User
    Join Date
    06-29-2015
    Location
    Buenos Aires, Argentina
    MS-Off Ver
    Microsoft Office 2013
    Posts
    4

    Searching for values using textbook in userform and populating spreadsheet with the row

    hello guys, I am in a bind here at work. I'm not very good at using VBA macros and have been assigned a project that deals with searching through various spreadsheets using userform that has textboxes and checkboxes. What I am trying to do is type a value in textbox1, for example, and it searches the sheet for that value in column 1 and only populates the sheet with rows that have the value I typed in the textbox1. If that value doesn't exist or is wrong, i want it to say no match found. Same goes for the next textbook, which will actually be looking through a different column within the spreadsheet but once the textbook value matches the ones on the spreadsheet, i want it to populate it with those rows that have that value. I have the command buttons down (search, cancel, etc), the part i am stumped on is the textbox. The code I have is as follows below for the first textbox, but it does not work fully. Also, how would I continue the code with the second texbox search function without it interfering with the first?

    'Private Sub CommandButtonOk_Click()



    Sheet4.Activate
    
       Dim Found As Range
     
            
            Set Found = Sheets("Sheet4").Range("A:A").Find(What:=Me.TextBox1.Value, _
                                                           LookIn:=xlValues, _
                                                           LookAt:=xlWhole, _
                                                           SearchOrder:=xlByRows, _
                                                           SearchDirection:=xlNext, _
                                                           MatchCase:=False)
           If Found Is Nothing Then
              MsgBox "No match for " & Me.TextBox1.Value, , "No Match Found"
            Else
                Found.Offset(0, 1).Value = TextBox2.Value
            End If
            
    
        
        
    End Sub
    Last edited by jamildeen; 06-30-2015 at 08:13 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Populating values in userform from hidden columns
    By vermeulj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2015, 03:34 AM
  2. [SOLVED] How can I add Hyperlink for Thisworkbook.Worksheet with userform textbook
    By sanjaypalsjp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-06-2015, 09:38 AM
  3. [SOLVED] populating spreadsheet from userform
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2012, 03:24 PM
  4. Need help searching worksheet for userform textbox values
    By bsweet0us in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-16-2011, 10:57 AM
  5. Seeking Input through userform and searching the spreadsheet for corresponding entry
    By himanshu83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2010, 02:14 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