Private Sub cmdload_Click()
On Error Resume Next
With Application.FileDialog(1)
.Filters.Clear
.Filters.Add "Excel Files", "*.xls", 1
.Show: .AllowMultiSelect = False
Workbooks.Open .SelectedItems(1)
End With
If Worksheets("sheet1").Range("A1").Value = "" And Worksheets("sheet1").Range("A2").Value = "" Then
MsgBox "vui long chon lai file"
Else
'load du lieu phan tich theo mua
i = 1
j = 1
While Sheets("sheet1").Range("A1").Offset(i - 1, j - 1).Value <> ""
j = j + 1
Wend
j = j - 1
While Sheets("sheet1").Range("A" & i).Value <> ""
i = i + 1
Wend
i = i - 1
Sheets("sheet1").Range("A" & 1 & ":S" & i).Select
Selection.Copy
Windows("detaidubao.xls").Worksheets("load").Select
Range("A1").Select
ActiveSheet.Paste
End If
End Sub
Em copy bảng dữ liệu từ sheet dc chọn sang sheet "load" của file excel "detaidubao", nhưng ko hiểu sao lúc chạy dc lúc không, còn bây giờ thì lỗi. Các bạn giúp em với