Code: Select all
Private Sub CommandButton1_Click()
lastrow = Cells(Rows.Count, 3).End(xlUp).Row
With Worksheets("ʵçÍ¡ÇÑÊ´Ø")
With Range("c1:c" & lastrow)
Set c = .Find(TextBox1.Text, LookIn:=xlValues)
If TextBox2.Text = "" Then
MsgBox "¡ÃسÒãÊè¨Ó¹Ç¹¤èÐ"
ElseIf Not c Is Nothing Then
With Worksheets("ʵçÍ¡ÇÑÊ´Ø")
c.Offset(0, 2).Value = c.Offset(0, 2).Value + CInt(TextBox2.Value)
MsgBox c.Offset(0, 2)
End With
Else
With Worksheets("ʵçÍ¡ÇÑÊ´Ø")
Do
l = l + 1
Loop Until .Cells(l, 1) = ""
.Cells(l, 1) = l - 1
.Cells(l, 2) = TextBox5.Value
.Cells(l, 3) = TextBox1.Text
.Cells(l, 4) = ComboBox1.Text
.Cells(l, 5) = TextBox2.Value
.Cells(l, 6) = ComboBox2.Text
.Cells(l, 7) = TextBox3.Text
MsgBox "ww"
End With
End If
If TextBox2.Value <> "" Then
With Worksheets("ÃѺÇÑÊ´Ø")
Do
r = r + 1
Loop Until .Cells(r, 1) = ""
.Cells(r, 1) = r - 1
.Cells(r, 2) = TextBox5.Value
.Cells(r, 3) = TextBox1.Text
.Cells(r, 4) = ComboBox1.Text
.Cells(r, 5) = TextBox2.Value
.Cells(r, 6) = ComboBox2.Text
.Cells(r, 7) = TextBox3.Text
End With
End If
End With
End With
End Sub
จากโค๊ดข้างต้น
ทำไมเวลาเช็คหา c มันถึงเช็คเฉพาะหน้าชีท ที่เราอยู่ด้วยครับ
ปัญหาคือ?
จะทำยังไงให้มันไปเช็คเอง โดยที่เราไม่จำเป็นต้องอยู่หน้าที่ให้มันเช็ค
เพราะตอนนี้ผมต้องไปหน้า สต็อกวัสดุ เพื่อให้มันเช็ค จะไปชีทลงทะเบียนก็ไม่ได้เพราะมันไม่เช็คมันเช็คเฉพาะชีทที่ทำการเปิดอยู่เท่านั้น
ขอรบกวนผู้รู้ทุกท่านด้วยนะครับ
โค็ดนี้อยู่ที่ Userform1 ครับ
You do not have the required permissions to view the files attached to this post.