Có đôi lúc bạn cần đặt tên cho dữ liệu được tìm thấy. Bạn có thể dùng đoạn mã sau để thiết lập chúng.
Sub datten()
Cells.Find(What:="hello", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Dim cell As Range
Set cell = ActiveCell.Offset(0, 6)
    ActiveWorkbook.Names.Add Name:="cuoicung", RefersToR1C1:=cell
    ActiveWorkbook.Names("cuoicung").Comment = ""
End Sub
Ứng dụng
Dùng để lựa chọn mảng dữ liệu theo tên đã được thiết lập mà không phụ thuộc vào vị trí của ô
Sub Macro1()
    Range("batdau:cuoicung").Select
End Sub
airplanemode_active