snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub CommandButton6_Click()
Dim Row As Integer
Row = 2
Sheets("set2").Copy
For Row = 1 To 2000
On Error Resume Next
If Sheet1.Cells(Row, 14) = "set2" Then
nRow = Sheets("set2").Columns(1).Find(Empty).Row
For i = 1 To 13
Sheets("set2").Cells(nRow, i) = Sheet1.Cells(Row, i)
Next i
End If
Next Row
Dim ow As Integer
ow = 2
Sheets("set2").Copy
For ow = 1 To 2000
If Sheet1.Cells(ow, 14) = "set1" Then
nRow = Sheets("set2").Columns(1).Find(Empty).Row
For i = 1 To 13
Sheets("set2").Cells(nRow, i) = Sheet1.Cells(ow, i)
Next i
End If
Next ow
End Sub
Private Sub CommandButton6_Click()
Dim Row As Integer
Row = 2
Sheets("set").Copy
For Row = 1 To 2000
On Error Resume Next
If Sheet1.Cells(Row, 14) = "set2" Then
nRow = Sheets("set").Columns(1).Find(Empty).Row
For i = 1 To 14
Sheets("set").Cells(nRow, i) = Sheet1.Cells(Row, i)
Next i
End If
Next Row
Dim ow As Integer
ow = 2
Sheets("set").Copy
For ow = 1 To 2000
If Sheet1.Cells(ow, 14) = "set1" Then
nRow = Sheets("set").Columns(1).Find(Empty).Row
For i = 1 To 14
Sheets("set").Cells(nRow, i) = Sheet1.Cells(ow, i)
Next i
End If
Next ow
End Sub
You do not have the required permissions to view the files attached to this post.
Private Sub CommandButton6_Click()
Dim Row As Integer
Row = 2
Sheets("set").Copy
For Row = 1 To 2000
On Error Resume Next
If Sheet1.Cells(Row, 14) = "set2" Then
nRow = Sheets("set").Columns(1).Find(Empty).Row
For i = 1 To 14
Sheets("set").Cells(nRow, i) = Sheet1.Cells(Row, i)
Next i
End If
Next Row
ThisWorkbook.Activate
Dim ow As Integer
ow = 2
Sheets("set").Copy
For ow = 1 To 2000
If Sheet1.Cells(ow, 14) = "set1" Then
nRow = Sheets("set").Columns(1).Find(Empty).Row
For i = 1 To 14
Sheets("set").Cells(nRow, i) = Sheet1.Cells(ow, i)
Next i
End If
Next ow
End Sub