jimmycuong
Thành viên mới

- Tham gia
- 16/8/07
- Bài viết
- 7
- Được thích
- 0
Chào các bạn, mình có làm 1 cái list box trong đó có cho chon 1 vài sheet để thực hiện lệnh xuất ra file excel hoặc PDF, tuy nhiên chỉ xuất đc 1 sheet thôi, mình nghĩ là câu lệnh nó đã qua cái sheet mới nên nó ko lấy đc dữ liệu của sheet cũ.
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Dim L As Long
For L = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(L) = True Then
Sheets(Array(ListBox1.List(L))).Copy
With ActiveWorkbook
Sheets(ListBox1.List(L)).[A1:AR3000].Value = Sheets(ListBox1.List(L)).[A1:AR3000].Value
Application.ScreenUpdating = True
End With
End If
Next
End Sub
Khi chọn từ 2 sheet để xuất thi sẽ bị lỗi ngay dòng màu đỏ, có cao nhân nào giúp đỡ mình với
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Dim L As Long
For L = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(L) = True Then
Sheets(Array(ListBox1.List(L))).Copy
With ActiveWorkbook
Sheets(ListBox1.List(L)).[A1:AR3000].Value = Sheets(ListBox1.List(L)).[A1:AR3000].Value
Application.ScreenUpdating = True
End With
End If
Next
End Sub
Khi chọn từ 2 sheet để xuất thi sẽ bị lỗi ngay dòng màu đỏ, có cao nhân nào giúp đỡ mình với