跳到主要內容

如何從Excel中的一系列單元格創建序列工作表?

如果您的工作表中有一系列數據,現在,您想基於單元格數據創建一系列工作表,請參見以下屏幕截圖。 當然,您可以手動一個接一個地編輯工作表名稱,但是如果需要編輯多個工作表名稱,這種方式將很麻煩且耗時。 在這裡,我將討論一些可以幫助您的快速技巧。

doc-create-sheetsfrom-list1

使用VBA代碼從單元格列表中創建序列工作表

使用Kutools for Excel從單元格列表中創建序列工作表


箭頭藍色右氣泡 使用VBA代碼從單元格列表中創建序列工作表

下面的VBA代碼可以幫助您添加一些工作表,這些工作表是根據現有工作表之後的單元格內容命名的。 請這樣做:

1。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下代碼粘貼到 模塊窗口.

VBA代碼:根據單元格列表添加序列工作表

Sub CreateWorkSheetByRange()
'Update 20130829
Dim WorkRng As Range
Dim Ws As Worksheet
Dim arr As Variant
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
arr = WorkRng.Value
Application.ScreenUpdating = False
For i = 1 To UBound(arr, 1)
    For j = 1 To UBound(arr, 2)
        Set Ws = Worksheets.Add(after:=Application.ActiveSheet)
        Ws.Name = arr(i, j)
    Next
Next
Application.ScreenUpdating = True
End Sub

3。 然後按 F5 鍵運行此代碼,然後會彈出一個提示框,供您選擇要使用的範圍。 看截圖:

doc-create-sheetsfrom-list2

4。 然後點擊 OK,在現有工作表之後添加了由單元格值命名的工作表。 看截圖:

doc-create-sheetsfrom-list3

筆記:

1.新工作表將插入到當前工作表之後。

2.如果所選範圍包括空白單元格,則根據默認名稱命名工作表。 查看屏幕截圖:

doc-create-sheetsfrom-list4
-1
doc-create-sheetsfrom-list5

箭頭藍色右氣泡 使用Kutools for Excel從單元格列表中創建序列工作表

在這裡,我介紹一個方便的工具-Excel的Kutools,其 創建序列工作表,您可以使用月名稱,日名稱,自定義列表等快速創建工作表。

Excel的Kutools 包括300多個便捷的Excel工具。 30天免費試用,不受限制。 立即獲取.

安裝Kutools for Excel之後,請執行以下步驟:

1。 選擇要基於其創建工作表的範圍。

2. 點擊 企業 > 工作表工具 > 創建序列工作表,請參見屏幕截圖:

doc-create-sheetsfrom-list6

3。 在 創建序列工作表 對話框中,選擇要創建新序列工作表的工作表類型,然後檢查 範圍內的數據 選項,請參見屏幕截圖:

doc-create-sheetsfrom-list7

4。 然後點擊 OK 關閉對話框,並創建一個包含工作表的新工作簿,該工作簿由選定的範圍數據命名。 看截圖:

doc-create-sheetsfrom-list8

筆記:

1.如果您選擇工作表1或工作表2,創建的新工作表的格式將與工作表1或工作表2的格式相同。

2.在新的工作簿中創建新的工作表。

3.如果所選範圍包括空白單元格,則根據默認名稱命名工作表。 查看屏幕截圖:

doc-create-sheetsfrom-list9
-1
doc-create-sheetsfrom-list10

單擊以了解有關此創建序列工作表功能的更多信息。


相關文章:

如何在Excel中添加具有自定義名稱的新工作表?

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


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

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How to add bydefault table with row name and column name on sheets after creating sheets using command button. Please help.
This comment was minimized by the moderator on the site
How can the code be modified to copy a worksheet labeled "Template" and rename it to the values in the list selected in the range? I tried modifying the "worksheets.Add" code to "Worksheets("Template").Copy but it just makes copies with the worksheets labeled "Template(1)", "Template(2)", etc. Also, is there a way to put the tabs in numerical order as they are added?
This comment was minimized by the moderator on the site
Hi, Would it be possible to set-up a template for the new sheets created, instead of blank worksheets. Thanks Dave
This comment was minimized by the moderator on the site
Hi, I want to create invoices using excel and need to know whether is there a way to auto generate the second continuation page when the items on the first page exceed the A4 page layout that I have predefined? Any help is appreciated.
This comment was minimized by the moderator on the site
Could you modify the VBA code so that if the worksheet exists, it is skipped over? As it exists now, running the code a second time on the same range will create numbered worksheets. Thanks! Chris
This comment was minimized by the moderator on the site
Hello, Can I exclude blanks and automatically copy data with is behind the name? This data is generated from a pivot and I want to have all the names in different tabs with the data behind it in the layout. name1 data data data blank data data data blank Name 2 Thanks!
This comment was minimized by the moderator on the site
I need to duplicate one sheet when making all these new sheets from a list. Can you add the code for that? Thanks!
This comment was minimized by the moderator on the site
You can right click the tab and choose "move or copy" to duplicate it.
This comment was minimized by the moderator on the site
Very useful. thank you
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations