ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- 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
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