Note: The other languages of the website are Google-translated. Back to English
登入  \/ 
x
or
x
註冊  \/ 
x

or

如何在Excel的下拉列表中打印所有選項?

您是否曾經嘗試在Excel工作表的下拉列表中打印所有選項? 本文討論的是將下拉列表中的所有選項打印到Excel中的單獨打印輸出中。

使用VBA代碼在下拉列表上打印所有選項


使用VBA代碼在下拉列表上打印所有選項


以下VBA代碼可以幫助您在工作表的下拉列表中打印所有選項。 請執行以下操作。

1。 按 其他 + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2。 在裡面 Microsoft Visual Basic for Applications 窗口,請點擊 插入 > 模塊。 然後將以下VBA代碼複製到“模塊”窗口中。 看截圖:

VBA代碼:將指定下拉列表中的所有選項打印到單獨的打印輸出中

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

備註:在代碼中,Sheet1是工作表名稱,其中包含您要打印的下拉列表。 B8是包含下拉列表的單元格。 請用您需要的替換它們。

3。 按 F5 鍵來運行代碼。

然後,將單獨打印出特定工作表中指定下拉列表中的所有選項。


在Excel當前工作表中輕鬆打印指定的頁面:

隨著 打印特定頁面 的效用 Kutools for Excel,您可以輕鬆打印當前工作表中的指定頁面,例如全部打印 奇數頁所有 偶數頁,只打印 當前頁面,以及打印自定義頁面範圍,如下圖所示。
立即下載並試用! (30天免費試用)


相關文章:


最佳辦公效率工具

Kutools for Excel 解決了您的大部分問題,並將您的生產力提高了 80%

  • 重用: 快速插入 複雜的公式,圖表 以及您以前使用過的任何東西; 加密單元 帶密碼 創建郵件列表 並發送電子郵件...
  • 超級公式欄 (輕鬆編輯多行文本和公式); 閱讀版式 (輕鬆讀取和編輯大量單元格); 粘貼到過濾範圍...
  • 合併單元格/行/列 不會丟失數據; 拆分單元格內容; 合併重複的行/列...防止細胞重複; 比較範圍...
  • 選擇重複或唯一 行; 選擇空白行 (所有單元格都是空的); 超級查找和模糊查找 在許多工作簿中; 隨機選擇...
  • 確切的副本 多個單元格,無需更改公式參考; 自動創建參考 到多張紙; 插入項目符號,複選框等...
  • 提取文字,添加文本,按位置刪除, 刪除空間; 創建和打印分頁小計; 在單元格內容和註釋之間轉換...
  • 超級濾鏡 (將過濾方案保存並應用於其他工作表); 高級排序 按月/週/日,頻率及更多; 特殊過濾器 用粗體,斜體...
  • 結合工作簿和工作表; 根據關鍵列合併表; 將數據分割成多個工作表; 批量轉換xls,xlsx和PDF...
  • 300 多項強大功能。 支持Office / Excel 2007-2019和365。支持所有語言。 在您的企業或組織中輕鬆部署。 完整功能30天免費試用。 60天退款保證。
kte選項卡201905

Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
officetab底部
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    mich · 4 months ago
    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
    • To post as a guest, your comment is unpublished.
      Pyu Young · 1 days ago
      Hello Mich
      Have you found the VBA code for print all options in drop down list excluding the empty cell so as you can help is too.
  • To post as a guest, your comment is unpublished.
    Mich · 4 months ago
    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
  • To post as a guest, your comment is unpublished.
    Zack · 1 years ago
    Hi is there a way to be able to preview first all the possible printouts in my drop-down list before it actually prints?
  • To post as a guest, your comment is unpublished.
    tj123 · 2 years ago
    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?
  • To post as a guest, your comment is unpublished.
    Cloud · 2 years ago
    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?
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi Cloud,
      What version of Excel are you using?
      The problem can't be reproduced in my case. Sorry for the inconvenience.
      • To post as a guest, your comment is unpublished.
        Cloud · 1 years ago
        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!
  • To post as a guest, your comment is unpublished.
    Juliette · 3 years ago
    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.