nguyenanhdung8111982
Thành viên hoạt động



- Tham gia
- 1/11/19
- Bài viết
- 120
- Được thích
- 33
- Giới tính
- Nam
em có tìm thấy đoạn code như dưới tách chuỗi những ô có waraptext. Nhờ anh chị chuyển code từ sub sang function sử dụng trong excel!!!
Hoặc sửa code khi chạy chọn theo range của cột thay vì click từng ô.

Hoặc sửa code khi chạy chọn theo range của cột thay vì click từng ô.
Mã:
Sub splitText()
'splits Text active cell using ALT+10 char as separator
Dim splitVals As Variant
Dim totalVals As Long
'Range(ActiveCell, ActiveCell.End(xlDown)).Select
splitVals = Split(ActiveCell.Value, Chr(10))
totalVals = UBound(splitVals)
Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
End Sub
