Hi, I am as new in VBA to Know about a set of code where i can get a Specific information from my data base. E.g If i enter a some of data to used a form and if i missed something or wish to amend some of incorrect data to correct in data base. How can i do this. I am using below code but not work. Can you plz help me to solved this issue.
Thanks in advance.
(N.B : Underline code is saying an error.)
Private Sub CommandButton4_Click()
Dim x As Long
Dim y As Long
x = Sheets("Sheet1").Range("a" & Rows.Count).End(xlUp).Row
For y = 2 To x
If Sheets("Sheet1").Cells(y, 2).Text = TextBox6.Value Then
TextBox1.Text = Sheets("Sheet1").Cells(y, 3)
TextBox1.Text = Sheets("Sheet1").Cells(y, 4)
TextBox1.Text = Sheets("Sheet1").Cells(y, 7)
TextBox1.Text = Sheets("Sheet1").Cells(y, 8)
TextBox1.Text = Sheets("Sheet1").Cells(y, 9)
ComboBox1.Text = Sheets("Sheet1").Cells(y, 5)
ComboBox2.Text = Sheets("Sheet1").Cells(y, 6)
End If
Next y
End Sub
Thanks in advance.
(N.B : Underline code is saying an error.)
Private Sub CommandButton4_Click()
Dim x As Long
Dim y As Long
x = Sheets("Sheet1").Range("a" & Rows.Count).End(xlUp).Row
For y = 2 To x
If Sheets("Sheet1").Cells(y, 2).Text = TextBox6.Value Then
TextBox1.Text = Sheets("Sheet1").Cells(y, 3)
TextBox1.Text = Sheets("Sheet1").Cells(y, 4)
TextBox1.Text = Sheets("Sheet1").Cells(y, 7)
TextBox1.Text = Sheets("Sheet1").Cells(y, 8)
TextBox1.Text = Sheets("Sheet1").Cells(y, 9)
ComboBox1.Text = Sheets("Sheet1").Cells(y, 5)
ComboBox2.Text = Sheets("Sheet1").Cells(y, 6)
End If
Next y
End Sub