Cần giúp đỡ code copy dữ liệu! (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

vova2209

Thành viên tích cực
Tham gia
5/4/17
Bài viết
835
Được thích
112
Giới tính
Nam
Nghề nghiệp
Đường bộ
Code đang ở Sheet30! code chỉ chạy được ở Sheet30 giờ em muốn chạy code cho sheet khác thì làm thế nào ạ!
--------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Const start_index = 20 'Dòng Paste du liêu
Dim Row_Index As Long
Dim Row_Data As Long
Dim Row_Height As Long
Dim j As Long
If InStr(Target.Address, "$A$") > 0 Then 'Vi tri cua Cell tai cot A
If Target.Count <> 1 Then Exit Sub 'Neu chon lon hon thi bo qua
Row_Data = FIND_INDEX_KieuThep(Range("A" & Target.row))
If Range("A" & Target.row) <> "" And Row_Data > 0 Then 'Nhâp kiêu thanh
Row_Index = Target.row
Row_Height = Sheet92.Range("C" & Row_Data).RowHeight 'Dô rông côt C Thu Viên
Sheet30.Range("D" & Row_Index).RowHeight = Row_Height
Sheet92.Activate
Sheet92.Range("B" & Row_Data & ":O" & Row_Data).Select 'Vùng copy du liêu
Application.CutCopyMode = False
Selection.Copy
Sheet30.Select
Sheet30.Range("B" & Row_Index).Select
ActiveSheet.Paste
Sheet30.Range("A" & Row_Index + 1).Select
Else
End If
End If
End Sub
 

File đính kèm

Code đang ở Sheet30! code chỉ chạy được ở Sheet30 giờ em muốn chạy code cho sheet khác thì làm thế nào ạ!
--------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Const start_index = 20 'Dòng Paste du liêu
Dim Row_Index As Long
Dim Row_Data As Long
Dim Row_Height As Long
Dim j As Long
If InStr(Target.Address, "$A$") > 0 Then 'Vi tri cua Cell tai cot A
If Target.Count <> 1 Then Exit Sub 'Neu chon lon hon thi bo qua
Row_Data = FIND_INDEX_KieuThep(Range("A" & Target.row))
If Range("A" & Target.row) <> "" And Row_Data > 0 Then 'Nhâp kiêu thanh
Row_Index = Target.row
Row_Height = Sheet92.Range("C" & Row_Data).RowHeight 'Dô rông côt C Thu Viên
Sheet30.Range("D" & Row_Index).RowHeight = Row_Height
Sheet92.Activate
Sheet92.Range("B" & Row_Data & ":O" & Row_Data).Select 'Vùng copy du liêu
Application.CutCopyMode = False
Selection.Copy
Sheet30.Select
Sheet30.Range("B" & Row_Index).Select
ActiveSheet.Paste
Sheet30.Range("A" & Row_Index + 1).Select
Else
End If
End If
End Sub
Em sửa được rồi!
Range("D" & Row_Index).RowHeight = Row_Height
'Sheet92.Activate
Sheet92.Range("B" & Row_Data & ":O" & Row_Data).Copy 'Vùng copy du liêu
'Application.CutCopyMode = False
'Selection.Copy
'Sheet30.Select
Range("B" & Row_Index).Select
ActiveSheet.Paste
Range("A" & Row_Index + 1).Select
-------------------------------------------------
Giờ muốn xóa các file ảnh trong vùng chỉ định làm thế nào ạ! giúp e với
 
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom