why this code doesn't work at all?

KalilMe

Active Member
Joined
Mar 5, 2021
Messages
354
Office Version
  1. 2016
Platform
  1. Windows
hi guys
I have this code but doesn't work at all , I try updating values in some columns based on filled values in multiple textboxes
VBA Code:
Private Sub CommandButton1_Click()
Dim sh As Worksheet
Dim sr As Range
Dim cl
Set sh = Sheets("sheet1")
c1 = Me.ComboBox1.Value
If c1 <> "" Then
 Set sr = ws.Columns(4).Find(c1, LookAt:=xlWhole)
 If Not c1 Is Nothing Then
 sh.Cells(sr.Row, "A") = Me.TextBox1.Value
 sh.Cells(sr.Row, "B") = Me.TextBox2.Value
 sh.Cells(sr.Row, "C") = Me.TextBox3.Value

 End If
End If
End Sub
can any body guide me where is the mistake ?
 
If it passes through all the lines, then it must be putting the values from the textboxes onto the sheet.
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
as you see in this picture when I try updating nothing happens .
about the match column I change to 2 not 4
DF.PNG
 
Upvote 0
There’s nothing wrong with the code. If that is the result after pressing Update, then it cannot be executing all of the code.
 
Upvote 0
actually I design again the file ,but the problem is in column C doesn't change . may you check it ,please ?
upd.xlsm
 
Upvote 0

Forum statistics

Threads
1,221,526
Messages
6,160,337
Members
451,637
Latest member
hvp2262

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