giaosy
Thành viên thường trực
- Tham gia
- 6/12/06
- Bài viết
- 205
- Được thích
- 144
Sub xu_ly_data()
Dim i, j, x As Integer
Dim dc, SR
Dim wsh As Worksheet
Set SR = Sheets("DATA").Range("A1:C4")
i = 2
j = 1
Application.ScreenUpdating = False
For x = 2 To ThisWorkbook.Worksheets.Count
Set wsh = Sheets(x)
wsh.Activate
dc = ActiveSheet.Range("A1").End(xlDown).Row
If Cells(i, j).Value = "" Then
For j = 1 To 3
Cells(i, j).Value = WorksheetFunction.VLookup(wsh.Name, SR, j, 0)
Next j
Else
For j = 1 To 3
Cells(dc, j).Offset(1).Value = WorksheetFunction.VLookup(wsh.Name, SR, j, 0)
Next j
End If
Next
Application.ScreenUpdating = True
End Sub
thanks các bác đã quan tâm
Dim i, j, x As Integer
Dim dc, SR
Dim wsh As Worksheet
Set SR = Sheets("DATA").Range("A1:C4")
i = 2
j = 1
Application.ScreenUpdating = False
For x = 2 To ThisWorkbook.Worksheets.Count
Set wsh = Sheets(x)
wsh.Activate
dc = ActiveSheet.Range("A1").End(xlDown).Row
If Cells(i, j).Value = "" Then
For j = 1 To 3
Cells(i, j).Value = WorksheetFunction.VLookup(wsh.Name, SR, j, 0)
Next j
Else
For j = 1 To 3
Cells(dc, j).Offset(1).Value = WorksheetFunction.VLookup(wsh.Name, SR, j, 0)
Next j
End If
Next
Application.ScreenUpdating = True
End Sub
thanks các bác đã quan tâm
Lần chỉnh sửa cuối: