Bỏ qua nội dung chính

Làm cách nào để in tất cả các tùy chọn trong danh sách thả xuống trong Excel?

Bạn đã bao giờ thử in tất cả các tùy chọn trong danh sách thả xuống trong trang tính Excel chưa? Bài viết này nói về việc in tất cả các tùy chọn trong danh sách thả xuống thành bản in riêng biệt trong Excel.

In tất cả các tùy chọn trên danh sách thả xuống với mã VBA


In tất cả các tùy chọn trên danh sách thả xuống với mã VBA

Mã VBA sau có thể giúp bạn in tất cả các tùy chọn trong danh sách thả xuống trong trang tính. Hãy làm như sau.

1. Nhấn nút Khác + F11 phím để mở Microsoft Visual Basic cho các ứng dụng cửa sổ.

2. bên trong Microsoft Visual Basic cho các ứng dụng cửa sổ, vui lòng nhấp vào Chèn > Mô-đun. Sau đó sao chép mã VBA sau vào cửa sổ Mô-đun. Xem ảnh chụp màn hình:

Mã VBA: In tất cả các tùy chọn trong danh sách thả xuống được chỉ định thành bản in riêng biệt

Sub Iterate_Through_data_Validation()
    Dim xRg As Range
    Dim xCell As Range
    Dim xRgVList As Range
    Set xRg = Worksheets("Sheet1").Range("B8")
    Set xRgVList = Evaluate(xRg.Validation.Formula1)
    For Each xCell In xRgVList
        xRg = xCell.Value
        ActiveSheet.PrintOut
    Next
End Sub

Chú thích: Trong mã, Sheet1 là tên trang tính chứa danh sách thả xuống bạn muốn in. Và B8 là ô chứa danh sách sổ xuống. Vui lòng thay thế chúng với nhu cầu của bạn.

3. Nhấn nút F5 phím để chạy mã.

Sau đó, tất cả các tùy chọn trong danh sách thả xuống được chỉ định trong một trang tính nhất định được in ra riêng.


Dễ dàng in các trang được chỉ định trong trang tính hiện tại trong Excel:

Với In các trang cụ thể tiện ích của Kutools cho Excel, bạn có thể dễ dàng in các trang được chỉ định trong trang tính hiện tại, chẳng hạn như in tất cả những trang lẻ, tất cả các trang chẵn, chỉ in trang hiện tại, cũng như in phạm vi trang tùy chỉnh như ảnh chụp màn hình bên dưới.
Tải xuống và dùng thử ngay bây giờ! (đường mòn miễn phí 30 ngày)


Bài viết liên quan:

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

🤖 Trợ lý AI của Kutools: Cách mạng hóa việc phân tích dữ liệu dựa trên: Thực thi thông minh   |  Tạo mã  |  Tạo công thức tùy chỉnh  |  Phân tích dữ liệu và tạo biểu đồ  |  Gọi các hàm Kutools...
Các tính năng phổ biến: Tìm, đánh dấu hoặc xác định các bản sao   |  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  |  Chuyển đổi trạng thái hiển thị của các cột ẩn  |  So sánh dãy và cột 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ố thành từ, 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 ô,...)   |   ... và nhiều hơn nữa

Nâng cao kỹ năng Excel của bạn với Kutools for Excel và trải nghiệm hiệu quả hơn bao giờ hết. Kutools for Excel cung cấp hơn 300 tính năng nâng cao để tăng năng suất và tiết kiệm thời gian.  Bấm vào đây để có được tính năng bạn cần nhất...

Mô tả


Tab Office mang lại giao diện Tab cho Office và giúp công việc của bạn trở nên dễ dàng hơn nhiều

  • Cho phép chỉnh sửa và đọc theo thẻ 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 (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I am using the code above which is work great.  Now I need to get it to use the cell reference as the file name when it saves.  How do I do that?
This comment was minimized by the moderator on the site
kalo ingin mencetak sebagian data di drop list, gimana caranya mas ?
terima kasih
This comment was minimized by the moderator on the site
Thanks i used the first option it s amazing but i need to add to it that if there is a blank cell it should not print that option
This comment was minimized by the moderator on the site
Hello MichHave you found the VBA code for print all options in drop down list excluding the empty cell so as you can help is too.
This comment was minimized by the moderator on the site
Hi,The following VBA code helps to print all options in a specific drop-down list excluding the empty items. Hope I can help.<div data-tag="code">Sub Iterate_Through_data_Validation_NULL()
'Updated by Extendoffice 20211231
On Error Resume Next
Dim xRg As Range
Dim xCell As Range
Dim xRgVList As Range
Dim xNum, xF As Integer
xNum = 2
Set xRg = Worksheets("Sheet1").Range("B17")
Set xRgVList = Evaluate(xRg.Validation.Formula1)
xF = 1
For Each xCell In xRgVList
xRg = xCell.Value
If Trim(xCell.Value) = "" Then
Else
'ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End If
Next
End Sub
This comment was minimized by the moderator on the site
Thanks i used the first option it s amazing but i need to add to it that if there is a blank cell it should not print that option
This comment was minimized by the moderator on the site
Hi,
The following VBA code helps to print all options in a specific drop-down list excluding the empty items. Hope I can help.
<div data-tag="code">Sub Iterate_Through_data_Validation_NULL()
'Updated by Extendoffice 20211231
On Error Resume Next
Dim xRg As Range
Dim xCell As Range
Dim xRgVList As Range
Dim xNum, xF As Integer
xNum = 2
Set xRg = Worksheets("Sheet1").Range("B17")
Set xRgVList = Evaluate(xRg.Validation.Formula1)
xF = 1
For Each xCell In xRgVList
xRg = xCell.Value
If Trim(xCell.Value) = "" Then
Else
'ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End If
Next
End Sub
This comment was minimized by the moderator on the site
Hi is there a way to be able to preview first all the possible printouts in my drop-down list before it actually prints?
This comment was minimized by the moderator on the site
Hi Zack,The following VBA code helps to have a print preview before printing. After running the code, the print preview of a drop-down item pops up, you need to manually close the print preview to get the option to print out. <div data-tag="code">Sub Iterate_Through_data_Validation_NULL()
'Updated by Extendoffice 20211231
On Error Resume Next
Dim xRg As Range
Dim xCell As Range
Dim xRgVList As Range
Dim xNum, xF As Integer
xNum = 2
Set xRg = Worksheets("Sheet1").Range("B17")
Set xRgVList = Evaluate(xRg.Validation.Formula1)
xF = 1
For Each xCell In xRgVList
xRg = xCell.Value
If Trim(xCell.Value) = "" Then
Else
ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End If
Next
End Sub
This comment was minimized by the moderator on the site
How can i select a specific droplist, i want to print? , For example if i have 200 names on my droplist and i want to print a specific list, maybe 50 out of 200, How will i do this please?
This comment was minimized by the moderator on the site
Hi,The VBA code below can help you achieve it. Please specify the number of items you want to print in the line "xNum = 10", and the first n options in the drop-down list will be printed out.<div data-tag="code">Sub Iterate_Through_data_Validation_Num1()
'Updated by Extendoffice 20211231
On Error Resume Next
Dim xRg As Range
Dim xCell As Range
Dim xRgVList As Range
Dim xNum, xF As Integer
xNum = 10 'the number of items you want to print
Set xRg = Worksheets("Sheet1").Range("B17")
Set xRgVList = Evaluate(xRg.Validation.Formula1)
xF = 1
For Each xCell In xRgVList
xRg = xCell.Value
'ActiveSheet.PrintPreview '??
ActiveSheet.PrintOut '??
If xF = xNum Then
Exit For
End If
xF = xF + 1
Next
End Sub
This comment was minimized by the moderator on the site
Thanks for the code. But I'm experiencing a minor issue when printing. When I tried to print the sheet with the drop down list. The first print out, prints the first item on the list while the next print out prints a blank data before it prints the second item from the list. What should I do?
This comment was minimized by the moderator on the site
Hi Cloud,
What version of Excel are you using?
The problem can't be reproduced in my case. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Sorry I totally forgot about this. I'm using Excel 2013.

So it wasn't actually a blank data.

I have this dynamic drop down list in cell R17 which also populates other cells in the worksheet using VLOOKUP Function. What happens during print out is that the odd-positioned items on the list appears on the cell while the even-positioned items seemed not to show up that's why I thought it's printing blank pages.

Thanks!
This comment was minimized by the moderator on the site
Thank you for the post, this has helped me a lot. I was wondering if you had a way to do VBA to print Page 1 based on one drop-down selection and print Page 1 and 2 based on another drop-down selection? Thanks for any help you can provide.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations