Results 1 to 1 of 1

Textbox values to match value in textbox 1 on a userform

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Textbox values to match value in textbox 1 on a userform

    Can anyone help me with a user form coding.

    I have a combo box that provides sheet names of a workbook. When select the sheet name the combobox fills my textboxes with data from the selected sheet. However in textbox 1 I have an employee name and my problem is that the data in the other textboxes are not for the specified value in textbox 1. Is there any way or can anyone help me with a vb code that can have the textboxes values match the search value in textbox1?

    I've also attached the workbook with the userform.

    Below is the code I am using:

    Private Sub ComboBox1_Change()
    Dim Ws As Worksheet, wb As Workbook
    Set Ws = ActiveWorkbook.Sheets(ComboBox1.Value)
    
    ComboBox1.Value = Ws.Name
    TextBox1.Text = TextBox1.Text
    
    Dim strSheet As String
     If ComboBox1.ListIndex > -1 Then
     strSheet = ComboBox1
     Sheets(strSheet).Select True
     Application.ScreenUpdating = False
    
    If ComboBox1.Value = Ws.Name Then
    If TextBox1.Text = TextBox1.Text Then
    
         ID_tb.Text = Range("C" & ComboBox1.ListIndex + 7)
         program_tb.Text = Range("B" & ComboBox1.ListIndex + 7)
         Schedules_tb.Text = Range("E" & ComboBox1.ListIndex + 7)
         StartTime_tb.Text = Range("F" & ComboBox1.ListIndex + 7)
         EndTime_tb.Text = Range("G" & ComboBox1.ListIndex + 7)
         Duration_tb.Text = Range("H" & ComboBox1.ListIndex + 7)
         SysProb_tb.Text = Range("O" & ComboBox1.ListIndex + 7)
         Break_tb.Text = Range("I" & ComboBox1.ListIndex + 7)
         Break2_tb.Text = Range("J" & ComboBox1.ListIndex + 7)
         Lunch_tb.Text = Range("K" & ComboBox1.ListIndex + 7)
         OTBreak_tb.Text = Range("L" & ComboBox1.ListIndex + 7)
         OTLunch_tb.Text = Range("M" & ComboBox1.ListIndex + 7)
         Unsch_tb.Text = Range("N" & ComboBox1.ListIndex + 7)
    
    
    End If
    
        End If
     End If
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  2. Userform to search textbox value to place other textbox values in worksheet
    By mattyh555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:38 AM
  3. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  4. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 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