thanh12345678
Thành viên mới
- Tham gia
- 4/3/10
- Bài viết
- 38
- Được thích
- 0
Các bạn cóa cách nào thay đổi tên sheet theo cell của sheet đó và nó tự động cập nhật tên không. mình không muốn khi thay đổi phải nhấn nút Run.
Bạn dùng thử cái này xem saoBạn nên đưa file, sự hỗ trợ sẽ nhanh hơn
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i
With ActiveSheet
If InStr(1, "$B$2;$B$3;$B$4", Target.Address) > 0 Then
For i = 1 To ThisWorkbook.Sheets.Count
If .Cells(i + 1, 2) <> "" Then ThisWorkbook.Sheets(i).Name = .Cells(i + 1, 2)
.Cells(i + 1, 1) = ThisWorkbook.Sheets(i).Name
Next
End If
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i
On Error GoTo Thoat
With ActiveSheet
If InStr(1, "$B$2;$B$3;$B$4", Target.Address) > 0 Then
For i = 1 To ThisWorkbook.Sheets.Count
If .Cells(i + 1, 2) <> "" Then ThisWorkbook.Sheets(i).Name = .Cells(i + 1, 2)
.Cells(i + 1, 1) = ThisWorkbook.Sheets(i).Name
Next
End If
End With
Exit Sub
Thoat:
MsgBox "Ban kiem tra rat co the bi trung ten sheet"
End Sub