snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub Click11111()
If Range("A1").Value = "" Then
MsgBox "โปรดระบุข้อมูลให้ครบถ้วน", vbCritical + vbOKOnly, "แจ้งเตือน"
Else
Dim mylastrow As Long
mylastrow = Sheets("Emp1").Range("A" & Rows.Count).End(xlUp).Row + 1
' Range("A9:D20").Copy
If (Range("F3:F99")) = "พนักงานผลิต 1" Then
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
' Sheets("sheet1").Range("D7").ClearContents
MsgBox "บันทึกรายการเรียบร้อยแล้ว ", vbInformation + vbOKOnly, "แจ้งให้ทราบ"
End If
End Sub
If (Range("F3:F99")) = "พนักงานผลิต 1" Then
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
ขอคำแนะนำหน่อยครับ
You do not have the required permissions to view the files attached to this post.
Sub Click11111()
Dim i As Long
Dim mylastrow As Long
' Range("A9:D20").Copy
With Sheets("Sheet1")
If .Range("A1").Value = "" Then
MsgBox "โปรดระบุข้อมูลให้ครบถ้วน", vbCritical + vbOKOnly, "แจ้งเตือน"
Else
For i = 3 To .Range("A" & .Rows.Count).End(xlUp).Row
If .Range("F" & i) = "พนักงานผลิต 1" Then
.Range("A" & i).Resize(, 11).Copy
mylastrow = Sheets("Emp1").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
Next i
' Sheets("sheet1").Range("D7").ClearContents
MsgBox "บันทึกรายการเรียบร้อยแล้ว ", vbInformation + vbOKOnly, "แจ้งให้ทราบ"
End If
End With
End Sub
Sub Click11111()
Dim i As Long
Dim mylastrow As Long
' Range("A9:D20").Copy
With Sheets("Sheet1")
If .Range("A1").Value = "" Then
MsgBox "โปรดระบุข้อมูลให้ครบถ้วน", vbCritical + vbOKOnly, "แจ้งเตือน"
Else
For i = 3 To .Range("A" & .Rows.Count).End(xlUp).Row
If .Range("F" & i) = "พนักงานผลิต 1" Then
.Range("A" & i).Resize(, 11).Copy
mylastrow = Sheets("Emp1").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
Next i
' Sheets("sheet1").Range("D7").ClearContents
MsgBox "บันทึกรายการเรียบร้อยแล้ว ", vbInformation + vbOKOnly, "แจ้งให้ทราบ"
End If
End With
End Sub
Sub Click11111()
Dim i As Long
Dim mylastrow As Long
' Range("A9:D20").Copy
With Sheets("Sheet1")
If .Range("A1").Value = "" Then
MsgBox "โปรดระบุข้อมูลให้ครบถ้วน", vbCritical + vbOKOnly, "แจ้งเตือน"
Else
For i = 3 To .Range("A" & .Rows.Count).End(xlUp).Row
If .Range("F" & i) = "พนักงานผลิต 1" Then
.Range("A" & i).Resize(, 11).Copy
mylastrow = Sheets("Emp1").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
Next i
' Sheets("sheet1").Range("D7").ClearContents
MsgBox "บันทึกรายการเรียบร้อยแล้ว ", vbInformation + vbOKOnly, "แจ้งให้ทราบ"
End If
End With
End Sub
Sub Click11111()
Dim i As Long
Dim mylastrow As Long
' Range("A9:D20").Copy
With Sheets("Sheet1")
If .Range("A1").Value = "" Then
MsgBox "โปรดระบุข้อมูลให้ครบถ้วน", vbCritical + vbOKOnly, "แจ้งเตือน"
Else
For i = 3 To .Range("A" & .Rows.Count).End(xlUp).Row
If .Range("F" & i) = "พนักงานผลิต 1" Then
.Range("A" & i).Resize(, 11).Copy
mylastrow = Sheets("Emp1").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Emp1").Range("A" & mylastrow).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationNone, , False
End If
Next i
' Sheets("sheet1").Range("D7").ClearContents
MsgBox "บันทึกรายการเรียบร้อยแล้ว ", vbInformation + vbOKOnly, "แจ้งให้ทราบ"
End If
End With
End Sub