สวัสดีครับ
ขอถามเพิ่มเติมครับ
ผมลองหาวิธีเอาตัวเลข 10 หลักที่อยู่ใน sheet 1 เอกสารแรก
มาทำการหาต่อว่ามีอยู่ใน เอกสารที่สองหรือไม่
ถ้ามีให้นำรายการใน column B ในเอกสารที่สอง
มาเพิ่มใน column D ของเอกสารแรก
และถ้าไม่มีให้แสดงค่าว่า NO DATA ใน column D ของเอกสารแรก และเปลี่ยนสีเป็นสีแดง
ผมลองใช้แมโครแล้ว และลองแก้ไข code แล้วไม่สามารถทำได้นะครับ อยู่ใน Module 2
Code: Select all
Dim i As Integer
i = 1
For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
Selection.Copy.Range("A" & i).Value
Workbooks.Open Filename:= _
"C:\Documents and Settings\T02083\My Documents\ref.xls"
Windows("ref.xls").Activate
If Workbooks("test yes0 t1.xls").Range("A" & i).Value = Range("A" & i).Value Then
Selection.Copy.Range("B" & i).Value
Windows("test yes0 t1.xls").Activate
Range("D" & i).Select
ActiveSheet.Paste
Else
ActiveCell.FormulaRiCi = "no data"
Rows("i:i").Select
Selection.Font.ColorIndex = 3
End If
Next i
End Sub
ช่วยแนะนำด้วยครับ
You do not have the required permissions to view the files attached to this post.