Value not shown in ComboBox1 when code run

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
I have the code in use below
My userform has TextBox3 value & ComboBox1
The code runs & i expect to see the value of TextBox3 placed in ComboBox1
Then the values are sent to the worksheet.

When i step through the code i do not see the value placed in ComboBox1 so i can see it,yes its added to the list & yes the value is transfered to worksheet BUT why do i not see it placed there.
My line of code in Red below should have done this for me ?

The code works & does what i ask but just wondering why i dont see a value

Code:
Private Sub AddKeyToTableList_Click()
Dim response As Integer
Dim oNewRow As ListRow
' ADD NEW KEY TYPE TO TABLE
With Sheets("INFO").ListObjects("Table38")
  If IsError(Application.Match(Me.TextBox3.Value, .ListColumns(1).DataBodyRange.Value, 0)) Then
    Set oNewRow = .ListRows.Add
    oNewRow.Range.Cells(1) = Me.TextBox3.Value

    .Sort.SortFields.Clear
    .Sort.SortFields.Add KEY:=.ListColumns(1).Range, SortOn:=xlSortOnValues, _
                         Order:=xlAscending, DataOption:=xlSortTextAsNumbers
    With .Sort
      .Header = xlYes
      .Apply
    End With
    Application.Goto (.HeaderRowRange.Cells(1))
    Sheets("INV").Select                         'RELOAD INV WORKSHEET
    
    ComboBox1.Value = Me.TextBox3.Value
  Else
    MsgBox Me.TextBox3.Value & " KEY TYPE ALRADY EXISTS", vbInformation, "KEY TYPE EXISTS MESSAGE"
  End If
End With

ThisWorkbook.Worksheets("INV").Range("G39") = Me.TextBox1.Text ' BITING SENT TO WORKSHEET CELL G39
ThisWorkbook.Worksheets("INV").Range("G40") = Me.ComboBox1.Text ' KEY TYPE USED SENT TO WORKSHEET CELL G40
Dim wb As Workbook
        Set wb = Workbooks.Open(fileName:="C:\Users\Ian\Desktop\REMOTES ETC\DR\EXCEL WORKSHEETS\MOTORCYCLES.xlsm")
        
        Workbooks("MOTORCYCLES.xlsm").Sheets("INVOICES").Activate
        
        ActiveSheet.Rows("3").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
              
        Workbooks("DR.xlsm").Sheets("INV").Range("G13").Copy ' CUSTOMERS NAME
        wb.Sheets("INVOICES").Range("A3").PasteSpecial xlPasteValues
        
        Workbooks("DR.xlsm").Sheets("INV").Range("L16").Copy ' FRAME NUMBER
        wb.Sheets("INVOICES").Range("B3").PasteSpecial xlPasteValues
        
        Workbooks("DR.xlsm").Sheets("INV").Range("L15").Copy ' REGISTRATION
        wb.Sheets("INVOICES").Range("C3").PasteSpecial xlPasteValues
        
        Workbooks("DR.xlsm").Sheets("INV").Range("G39").Copy ' BITING
        wb.Sheets("INVOICES").Range("D3").PasteSpecial xlPasteValues
            
        Workbooks("DR.xlsm").Sheets("INV").Range("G40").Copy ' TYPE OF KEY
        wb.Sheets("INVOICES").Range("E3").PasteSpecial xlPasteValues
        
        Workbooks("DR.xlsm").Sheets("INV").Range("L13").Copy ' DATE OF JOB
        wb.Sheets("INVOICES").Range("F3").PasteSpecial xlPasteValues
            
        Workbooks("DR.xlsm").Sheets("INV").Range("L4").Copy ' INVOICE NUMBER
        wb.Sheets("INVOICES").Range("G3").PasteSpecial xlPasteValues
        
        wb.Close True
        Application.CutCopyMode = False
        Unload Me
        With ActiveSheet
        Range("D1").Select
        End With
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If i add a Msgbox after the line shown below then i see the value in ComboBox1 but i dont want to have the Magbox

VBA Code:
Me.ComboBox1.Value = Me.TextBox3.Value
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top