hungyen2010
Thành viên mới
- Tham gia
- 18/10/10
- Bài viết
- 10
- Được thích
- 0
xin chào gpe em muốn chuyển câu lệnh về hàm vba
INDEX(Sheet1!$C$2:$C$10023,MATCH(Sheet2!C2,Sheet1!$D$2$10023,0))
em đã thử vba
dim lastrowsheet1,lastrowsheet2 As Long
lastrowsheet2 = Sheets(2).Cells(Sheets(2).Rows.Count, "c").End(xlUp).Row
lastrowsheet1 = Sheets(1).Cells(Sheets(1).Rows.Count, "a").End(xlUp).Row
For i = 1 To lasrowsheet2
sheets(2).range("a1"&i) = Application.WorksheetFunction.Index(Sheets(1).Range("c1" & lastrowsheet1), Application.WorksheetFunction.Match(Sheets(2).Range("a2"), Sheets(1).Range("d1" & lastrowsheet1), 0))
Next
End Sub
INDEX(Sheet1!$C$2:$C$10023,MATCH(Sheet2!C2,Sheet1!$D$2$10023,0))
em đã thử vba
dim lastrowsheet1,lastrowsheet2 As Long
lastrowsheet2 = Sheets(2).Cells(Sheets(2).Rows.Count, "c").End(xlUp).Row
lastrowsheet1 = Sheets(1).Cells(Sheets(1).Rows.Count, "a").End(xlUp).Row
For i = 1 To lasrowsheet2
sheets(2).range("a1"&i) = Application.WorksheetFunction.Index(Sheets(1).Range("c1" & lastrowsheet1), Application.WorksheetFunction.Match(Sheets(2).Range("a2"), Sheets(1).Range("d1" & lastrowsheet1), 0))
Next
End Sub