Quang Ròm
Thành viên mới

- Tham gia
- 18/4/23
- Bài viết
- 9
- Được thích
- 1
Nhờ anh em xử lý giúp em.
Hiện tại e có mã code trên excel offline nhờ ae chuyển giúp qua google sheet giúp ạ e cảm ơn rất nhiều:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row <> 2 Or Target.Column > 2 Then
Exit Sub
End If
If Target.Text = "" Then Exit Sub
Application.EnableEvents = False
If Target.Column = 1 Then
Range("A1").End(xlDown).Offset(1, 0).Value = Target.Value
Range("B2").Select
Else
Range("B1").End(xlDown).Offset(1, 0) = Target.Value
Range("A2").Select
End If
Application.EnableEvents = True
End Sub
-e muốn như excel là tại vị trí scanr ở a2 thì nhảy qua b2 và ngược lại. Sau khi scanr thì dữ liệu đẩy dồn xuống bên dưới ạ.
Hiện tại e có mã code trên excel offline nhờ ae chuyển giúp qua google sheet giúp ạ e cảm ơn rất nhiều:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row <> 2 Or Target.Column > 2 Then
Exit Sub
End If
If Target.Text = "" Then Exit Sub
Application.EnableEvents = False
If Target.Column = 1 Then
Range("A1").End(xlDown).Offset(1, 0).Value = Target.Value
Range("B2").Select
Else
Range("B1").End(xlDown).Offset(1, 0) = Target.Value
Range("A2").Select
End If
Application.EnableEvents = True
End Sub
-e muốn như excel là tại vị trí scanr ở a2 thì nhảy qua b2 và ngược lại. Sau khi scanr thì dữ liệu đẩy dồn xuống bên dưới ạ.