Bỏ qua nội dung chính

Cách bảo vệ nhiều bảng tính cùng lúc trong Excel?

Supposing you have a workbook which contains multiple worksheets, and now you need to protect all of the worksheets or some specific worksheets, normally in Excel, you only can protect the sheet one by one with the Protect Sheet function, but this method is tedious and time-consuming if there are numerous sheets need to be protected. How do you protect multiple sheets at once in Excel nhanh chóng và dễ dàng?

Bảo vệ tất cả các trang tính cùng một lúc bằng mã VBA

Bảo vệ nhiều trang tính cùng một lúc với Kutools for Excel

Bỏ bảo vệ nhiều trang tính cùng một lúc với kutools for Excel


mũi tên màu xanh bong bóng bên phải Bảo vệ tất cả các trang tính cùng một lúc bằng mã VBA

With the following VBA code, you can protect all the sheets of the active workbook at once with the same password, do as this:

1. Giữ ALT + F11 chìa khóa và nó mở Microsoft Visual Basic cho các ứng dụng cửa sổ.

2. Nhấp chuột Chèn > Mô-đunvà dán mã sau vào Cửa sổ mô-đun.

Mã VBA: Bảo vệ tất cả các trang tính trong sổ làm việc cùng một lúc:

Sub protect_all_sheets()
top: 
pass = InputBox("password?") 
repass = InputBox("Verify Password") 
If Not (pass = repass) Then 
MsgBox "you made a boo boo" 
Goto top 
End If 
For i = 1 To Worksheets.Count 
If Worksheets(i).ProtectContents = True Then Goto oops 
Next 
For Each s In ActiveWorkbook.Worksheets 
s.Protect Password:=pass 
Next 
Exit Sub 
oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets then running this Macro." 
End Sub

3. Sau đó nhấn F5 key to run the code, and input the password for the protected sheets in the prompt box, see screenshot:

doc-bảo vệ-nhiều trang tính1-1

4. Nhấp chuột OK, and then input the password again to confirm the password.

doc-bảo vệ-nhiều trang tính2-2

5. Sau đó nhấn vào OK, and all the sheets have been protected with the same password.


mũi tên màu xanh bong bóng bên phải Bảo vệ nhiều trang tính cùng một lúc với Kutools for Excel

Đôi khi, bạn không muốn bảo vệ tất cả các trang tính trong sổ làm việc của mình và chỉ muốn bảo vệ một số trang tính cụ thể, trong tình huống này, mã trên sẽ không hoạt động. Nhưng vơi Kutools for Excel'S Bảo vệ trang tính tiện ích, bạn có thể bảo vệ tất cả các trang tính và các trang tính cụ thể một cách nhanh chóng và dễ dàng.

Kutools for Excel : với hơn 300 tiện ích Excel phần bổ trợ, dùng thử miễn phí không giới hạn trong 60 ngày

Sau khi cài đặt Kutools for Excel, vui lòng thực hiện theo các bước sau:

1. Nhấp chuột Kutools Hơn > Bảo vệ trang tính, xem ảnh chụp màn hình:

2. Trong Bảo vệ trang tính hộp thoại, chọn trang tính mà bạn muốn được bảo vệ. (Theo mặc định, tất cả các trang tính trong sổ làm việc hiện tại đều được chọn.) Xem ảnh chụp màn hình:

doc-bảo vệ-nhiều trang tính4-4

3. và bấm OK, and then type and confirm the password in the Protect Worksheet dialog box. See screenshot:

doc-bảo vệ-nhiều trang tính5-5

4. Sau đó nhấn vào OK, các trang tính đã chọn đã được bảo vệ.

Nhấp vào Bảo vệ Trang tính để biết thêm về tính năng này.


mũi tên màu xanh bong bóng bên phải Bỏ bảo vệ nhiều trang tính cùng một lúc với kutools for Excel

Làm cách nào bạn có thể bỏ bảo vệ nhiều trang tính được bảo vệ trong một sổ làm việc cùng một lúc? Tất nhiên, Kutools for Excel cũng cung cấp Bỏ bảo vệ trang tính tiện ích cho bạn để bỏ bảo vệ chúng cùng một lúc.

Vui lòng thực hiện theo các bước sau:

1. Mở sổ làm việc của bạn có chứa các trang tính được bảo vệ.

2. Sau đó nhấn vào Kutools Hơn > Bỏ bảo vệ trang tính, xem ảnh chụp màn hình:

3. Trong Bỏ bảo vệ trang tính hộp thoại, các trang tính được bảo vệ được liệt kê vào hộp danh sách, sau đó bấm Ok nút, xem ảnh chụp màn hình:

doc-bảo vệ-nhiều trang tính7-7

4. Và sau đó một Bỏ bảo vệ trang tính dialog box pops out to remind you enter the password that you have created to protect the worksheets, see screenshot:

doc-bảo vệ-nhiều trang tính8-8

5. After typing the password, Click Ok, tất cả các trang tính đã chọn trong hộp danh sách đã không được bảo vệ.

LƯU Ý The worksheets must have the same password.

Để biết thêm về tính năng Unprotect Worksheet này.

Tải xuống và dùng thử miễn phí Kutools for Excel Ngay bây giờ!


mũi tên màu xanh bong bóng bên phải Demo: Bảo vệ hoặc Bỏ bảo vệ tất cả các trang tính cùng một lúc với Kutools for Excel

Kutools for Excel: với hơn 300 tiện ích Excel bổ trợ, dùng thử miễn phí không giới hạn trong 30 ngày. Tải xuống và dùng thử miễn phí ngay!

Bài viết liên quan:

Cách bỏ bảo vệ nhiều bảng tính cùng lúc trong Excel?

Công cụ năng suất văn phòng tốt nhất

Tăng cường bảng tính của bạn: Trải nghiệm hiệu quả hơn bao giờ hết với Kutools for Excel

Các tính năng phổ biến: Tìm/Đánh dấu/Xác định nội dung trùng lặp   |  Xóa hàng trống   |  Kết hợp các cột hoặc ô mà không làm mất dữ liệu   |   Vòng không có công thức hữu ích. Cảm ơn !
Siêu tra cứu: Nhiều tiêu chí VLookup    VLookup Nhiều Giá Trị  |   VLookup trên nhiều trang tính   |   Tra cứu mờ ....
Danh sách thả xuống nâng cao: Tạo nhanh danh sách thả xuống   |  Danh sách thả xuống phụ thuộc   |  Danh sách thả xuống nhiều lựa chọn ....
Trình quản lý cột: Thêm một số cột cụ thể     Di chuyển cột   |   Bỏ ẩn cột   |   So sánh các cột với Chọn các ô giống nhau và khác nhau hữu ích. Cảm ơn !
Các tính năng nổi bật: Tiêu điểm lưới   |  Chế độ xem thiết kế   |   Thanh công thức lớn    Trình quản lý sổ làm việc & trang tính   |  Thư viện tài nguyên (Văn bản tự động)   |  Bảng chọn ngày   |  Kết hợp các bảng tính   |  Mã hóa/Giải mã ô    Gửi email theo danh sách   |  Siêu lọc   |   Bộ lọc đặc biệt (lọc in đậm/nghiêng/gạch ngang...) ...
15 bộ công cụ hàng đầu12 bản văn CÔNG CỤ (thêm văn bản, Xóa ký tự,...)   |   50 + Biểu đồ Các loại (Biểu đồ Gantt,...)   |   40+ Thực tế Công thức (Tính tuổi dựa trên ngày sinh,...)   |   19 chèn CÔNG CỤ (Chèn mã QR, Chèn ảnh từ đường dẫn,...)   |   12 Chuyển đổi CÔNG CỤ (Số tới Words, Chuyển đổi tiền tệ,...)   |   7 Hợp nhất & Tách CÔNG CỤ (Các hàng kết hợp nâng cao, Chia ô,...)   |   Nhiều hơn nữahữu ích. Cảm ơn !

Kutools for Excel tự hào có hơn 300 tính năng, đảm bảo rằng những gì bạn cần chỉ là một cú nhấp chuột...

Hỗ trợ văn phòng/Excel 2007-2021 và mới hơn, bao gồm 365 | Có sẵn trong 44 ngôn ngữ | Tận hưởng bản dùng thử miễn phí 30 ngày đầy đủ tính năng.

tab kte 201905


Office Tab Mang giao diện theo thẻ vào Office và giúp công việc của bạn dễ dàng hơn nhiều

  • Cho phép chỉnh sửa theo thẻ và đọc trong Word, Excel, PowerPoint, Publisher, Access, Visio và Project.
  • Mở và tạo nhiều tài liệu trong các tab mới của cùng một cửa sổ, thay vì trong các cửa sổ mới.
  • Tăng 50% năng suất của bạn và giảm hàng trăm cú nhấp chuột cho bạn mỗi ngày!
Comments (21)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I am trying to use this in a shared workbook but I get a Microsoft Visual Basic error "Run-time error '1004": Application-defined or object-defined error" I am just looking for suggestions on how to get around this. Any help would be appreciated
This comment was minimized by the moderator on the site
Occurs when sheet is already locked
This comment was minimized by the moderator on the site
Thanks for the wonder full tool to protect & unprotect all the sheets at a time. Please guide me I am able to unprotect all sheets in my work book at a time but when I run protect all sheets VBA Code then only first 4 sheets are protected & rest or left unprotected. Please help me to sort out the issue.
This comment was minimized by the moderator on the site
How do I mask the password using the VBA method? I can not find this information via google or F1 help files. Thanks in advance!
This comment was minimized by the moderator on the site
Hi I used this code now I it wont accept my password to get back into my spreadsheet !!
This comment was minimized by the moderator on the site
I have chart tabs and worksheets in my Excel 2013 workbook. The VBA coding above works for the protecting the worksheets but not the separate chart tabs. How do i password protect the multiple chart tabs and multiple worksheets in my workbook? Thanks!
This comment was minimized by the moderator on the site
Hey, I need some help, the above code was very helpful, but it locks the sort (auto filter as well) can you please provide code to solve that problem and also where it would be inserted. Thank you in advance.
This comment was minimized by the moderator on the site
Thank you! This is awesome, I was even able to modify the VBA code so that I could unprotect all sheets at once! :) Sub unprotect_all_sheets() top: pass = InputBox("password?") repass = InputBox("Verify Password") If Not (pass = repass) Then MsgBox "you made a boo boo" GoTo top End If For i = 1 To Worksheets.Count Next For Each s In ActiveWorkbook.Worksheets s.Unprotect Password:=pass Next Exit Sub oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets B4 running this Macro." End Sub
This comment was minimized by the moderator on the site
when i activated this VBA, hyperlink doesn't work. how can i make them work? tnx :)
This comment was minimized by the moderator on the site
I am suddenly having the 1004 error as well. Anyone find a solution?
This comment was minimized by the moderator on the site
I'm suddenly having the error 1004 issue. Have been using the macro for months now it randomly fails.
This comment was minimized by the moderator on the site
when I imput the code it comes up with "run time error 1004?? highlighting the following in yellow... s.Protect Password:=pass
This comment was minimized by the moderator on the site
I'm suddenly having the 1004 error as well. I have been using the macro for months but now it won't run.
This comment was minimized by the moderator on the site
Hi, I was having this issue too. Turns out it can't run if you have all sheets selected in the workbook. Try selecting just one sheet and then running.
This comment was minimized by the moderator on the site
As Kristin said, how do you unprotect them all at once?
This comment was minimized by the moderator on the site
So, how do I unprotect without kutools?
This comment was minimized by the moderator on the site
[quote]So, how do I unprotect without kutools?By cz[/quote] You can unprotect the worksheet without Kutools for Excel. You just need to right click on the sheet tab which you want to unprotect and click Unprotect Sheet command, and then enter your password. :-)
This comment was minimized by the moderator on the site
Thank you so much :-)
This comment was minimized by the moderator on the site
Great--so how to UNprotect them all at once? I'm an amateur, so I need more info.
This comment was minimized by the moderator on the site
Sub unprotect_all_sheets() top: pass = InputBox("password?") repass = InputBox("Verify Password") If Not (pass = repass) Then MsgBox "you made a boo boo" GoTo top End If For i = 1 To Worksheets.Count Next For Each s In ActiveWorkbook.Worksheets s.Unprotect Password:=pass Next Exit Sub oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets B4 running this Macro." End Sub
This comment was minimized by the moderator on the site
[quote]Great--so how to UNprotect them all at once? I'm an amateur, so I need more info.By Kristin Dzugan[/quote] :-) You can easily unprotect them as http://www.extendoffice.com/product/kutools-for-excel/excel-unprotect-multiple-sheets.html
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations