swalowbird
Thành viên mới

- Tham gia
- 22/5/16
- Bài viết
- 49
- Được thích
- 1
Em có code này , bị báo lỗi Object not defined , mọi người sửa giúp em
Em muốn làm tờ phiếu giao nhận , lấy mã từ sheet1 , tìm kiếm trong sheet data , sau đó insert trong sheet pgn
thanks !
Đang ko biết lỗi ở đâu !!!!!!
Sub bbbb()
Dim k As Integer
Dim rng1 As Range
Dim rng2 As Range
Dim tim As Range
Dim cell As Range
Set rng1 = Application.InputBox(Prompt:="chon vung nhap du lieu ", Title:="Range Select", Type:=8)
k = rng1.Rows.Count
Set rng2 = rng1.Range(Cells(1, 1), Cells(k, 1))
rng2.Select
For Each cell In rng2
Set tim = Worksheets("data").Application.Find(cell, , xlFormulas, xlWhole)
If Not tim Is Nothing Then
tim.EntireRow.Copy
Worksheets("pgn").Range("A10000").End(xlUp).EntireRow.Insert Shift:=xlDown
End If
Next cell
End Sub
Em muốn làm tờ phiếu giao nhận , lấy mã từ sheet1 , tìm kiếm trong sheet data , sau đó insert trong sheet pgn
thanks !
Đang ko biết lỗi ở đâu !!!!!!
Sub bbbb()
Dim k As Integer
Dim rng1 As Range
Dim rng2 As Range
Dim tim As Range
Dim cell As Range
Set rng1 = Application.InputBox(Prompt:="chon vung nhap du lieu ", Title:="Range Select", Type:=8)
k = rng1.Rows.Count
Set rng2 = rng1.Range(Cells(1, 1), Cells(k, 1))
rng2.Select
For Each cell In rng2
Set tim = Worksheets("data").Application.Find(cell, , xlFormulas, xlWhole)
If Not tim Is Nothing Then
tim.EntireRow.Copy
Worksheets("pgn").Range("A10000").End(xlUp).EntireRow.Insert Shift:=xlDown
End If
Next cell
End Sub