Mismatch Error VBA Excel

SSF1590

Board Regular
Joined
Oct 20, 2019
Messages
73
Hello,

I have the below code that have the purpose to update information in an already exiting database based on the TARA # in ComboBox1. This TARA # is the first column (A) in my workbook "TARADatabase). When I run the code, it gives me error 13 mismatch in the line i made bold in the code. the TARA # is compose of numbers and letters. This is the format, TARA-19-001. Can someone please help me? I do not know what I should change in the code to run properly.

Thank you.


Private Sub CommandButton1_Click()


If Me.ComboBox1.Value = "" Then


MsgBox "TARA Can Not be Blank!", vbExclamation, "TARA"


Exit Sub


End If


TARA = Me.ComboBox1.Value
Sheets("TARADatabase").Select


Dim rowselect As String


rowselect = Me.ComboBox1.Value
rowselect = rowselect + l
Rows(rowselect).Select


Cells(rowselect, 4) = Me.TextBox4.Value
Cells(rowselect, 5) = Me.TextBox5.Value
Cells(rowselect, 6) = Me.TextBox6.Value
Cells(rowselect, 7) = Me.TextBox8.Value
Cells(rowselect, 8) = Me.TextBox9.Value
Cells(rowselect, 9) = Me.TextBox10.Value
Cells(rowselect, 10) = Me.TextBox11.Value
Cells(rowselect, 11) = Me.TextBox12.Value
Cells(rowselect, 12) = Me.TextBox13.Value
Cells(rowselect, 12) = Me.TextBox14.Value
Cells(rowselect, 14) = Me.TextBox15.Value
Cells(rowselect, 15) = Me.TextBox16.Value
Cells(rowselect, 16) = Me.TextBox17.Value
Cells(rowselect, 17) = Me.TextBox18.Value
Cells(rowselect, 18) = Me.TextBox19.Value
Cells(rowselect, 19) = Me.TextBox23.Value


End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi,
looking at your code I suspect part of your problem maybe this

Rich (BB code):
rowselect = rowselect + l

try replacing character show in RED with 1 (one) and see if resolves your issue

Dave
 
Last edited:
Upvote 0
Are you trying to find the combobox value in the sheet & then update that row, or are you trying to add the info to the next blank row?
 
Upvote 0
I am trying to find the combobox value in the sheet and then update that row, not add the info to the next blank row.

I follow your above instructions by replacing the one in this line,
rowselect = rowselect + l
but the when I debug the error indicates me to be in this line:

Rows(rowselect).Select
 
Upvote 0
How are you populating the combobox?
 
Upvote 0
Hi,
did suggest may only be part of the problem.

Perhaps maybe you should be using the ListIndex property of the control

Rich (BB code):
rowselect = Me.ComboBox1.ListIndex
rowselect = rowselect + 1


Rows(rowselect).Select

Giving detail to Fluffs question would be helpful to forum


Dave
 
Upvote 0
I have added ListIndex in the line, but I still get the same error in the line in bold below. The third line.

rowselect = Me.ComboBox1.ListIndex
rowselect = rowselect + 1.
Rows(rowselect).Select
 
Upvote 0
I have added ListIndex in the line, but I still get the same error in the line in bold below. The third line.

rowselect = Me.ComboBox1.ListIndex
rowselect = rowselect + 1.
Rows(rowselect).Select


Suggest respond to Fluffs questions for further guidance.

Dave
 
Upvote 0
Sorry I missed this question. I am populating the combobox using this code

Private Sub UserForm_Initialize()


With Sheets("TARADatabase")
Me.ComboBox1.List = .Range("A4", .Range("A" & Rows.Count).End(xlUp)).Value
End With


End Sub
 
Last edited:
Upvote 0
Ok, try
Code:
Sheets("TARADatabase").Select


Dim rowselect As Long


rowselect = Me.ComboBox1.ListIndex + 4



Cells(rowselect, 4) = Me.TextBox4.Value
Cells(rowselect, 5) = Me.TextBox5.Value
Cells(rowselect, 6) = Me.TextBox6.Value
Cells(rowselect, 7) = Me.TextBox8.Value
Cells(rowselect, 8) = Me.TextBox9.Value
Cells(rowselect, 9) = Me.TextBox10.Value
Cells(rowselect, 10) = Me.TextBox11.Value
Cells(rowselect, 11) = Me.TextBox12.Value
Cells(rowselect, 12) = Me.TextBox13.Value
Cells(rowselect, 12) = Me.TextBox14.Value
Cells(rowselect, 14) = Me.TextBox15.Value
Cells(rowselect, 15) = Me.TextBox16.Value
Cells(rowselect, 16) = Me.TextBox17.Value
Cells(rowselect, 17) = Me.TextBox18.Value
Cells(rowselect, 18) = Me.TextBox19.Value
Cells(rowselect, 19) = Me.TextBox23.Value


End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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