跳到主要內容

如何在Excel中復制多個選擇或範圍?

例如,您有一個很大的工作表,現在您只想複製一些選定範圍並分發到其他工作表。 但是,當您選擇多個範圍並單擊“複製”時,將出現一個提示對話框,提醒您“該命令不能用於多個選擇。” 在這種情況下,如何快速復制多個選定範圍? 這裡有一些技巧可以幫助您解決此任務。


使用剪貼板複製多個選定範圍

的幫助下 剪貼板,您可以一次將所有選定範圍粘貼到另一個範圍或工作表。 請執行以下操作:

1。 點擊 首頁 > doc複製多個範圍09 ,在 剪貼板 組以顯示 剪貼板 麵包.。 看截圖:

2。 然後一一複制所需的選定範圍。 同時,複製的範圍已出現在 剪貼板 麵包. 參見上面的截圖:

3。 選擇將所有復制的範圍粘貼到的目標範圍的第一個單元格,然後單擊 全部粘貼 按鈕在 剪貼板 窗格。

然後,所有復制的範圍都已粘貼到指定的目標範圍中。

輕鬆地將多個工作表/工作簿中的多個選擇組合到單個工作表/工作簿中

將來自不同工作簿的數十張表合併為一張表可能很麻煩。 但是使用Kutools for Excel的 合併(工作表和工作簿) 實用程序,只需單擊幾下就可以完成!


廣告組合床單書1

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!

使用VBA代碼複製多個選定範圍

使用VBA代碼,您還可以復制多個選定範圍並將其粘貼到任何其他工作表中。

1。 持有 按Ctrl 鍵,然後選擇要使用的多個非相鄰範圍。

2。 按 其他 + F11 鍵同時打開 適用於應用程序的Microsoft Visual Basic 窗口中,單擊 插入 > 模塊,然後將以下代碼輸入到模塊中:

選項顯式子CopyMultipleSelection()Dim SelAreas()作為範圍Dim PasteRange作為範圍Dim UpperLeft作為範圍Dim NumAreas作為整數,i作為整數Dim TopRow如長,LeftCol作為整數Dim RowOffset如長,ColOffset如整數Dim NonEmptyCellCount如整數如果未選擇範圍,則如果TypeName(Selection)<>“ Range”,則MsgBox“選擇要復制的範圍。允許多項選擇。” 退出子結束如果'將區域存儲為單獨的範圍對象,則NumAreas = Selection.Areas.Count ReDim SelAreas(1到NumAreas)對於i = 1到NumAreas設置SelAreas(i)= Selection.Areas(i)Next'確定左上角多個選擇中的單元格TopRow = ActiveSheet.Rows.Count LeftCol = ActiveSheet.Columns.Count對於i = 1到NumAreas如果SelAreas(i).Row <TopRow然後TopRow = SelAreas(i).Row如果SelAreas(i).Column <LeftCol然後LeftCol = SelAreas(i)。列Next Set UpperLeft = Cells(TopRow,LeftCol)'在錯誤繼續時獲取粘貼地址Next Set PasteRange = Application.InputBox _(Prompt:=“請指定粘貼的左上單元格範圍:“,_標題:=”複製多重選擇“,_類型:= 8)發生錯誤時GoTo 0'如果取消,則退出如果TypeName(PasteRange)<>” Range“然後退出Sub'確保僅左上方的單元格使用的Set PasteRange = PasteRange.Range(“ A1”)'檢查現有數據的粘貼範圍NonEmptyCellCount = 0對於i = 1到NumAreas RowOffset = SelAreas(i)。行-TopRow ColOffset = Sel Areas(i).Column-LeftCol NonEmptyCellCount = NonEmptyCellCount + _ Application.CountA(Range(PasteRange.Offset(RowOffset,ColOffset),_ PasteRange.Offset(RowOffset + SelAreas(i).Rows.Count-1,_ ColOffset + SelAreas) (i).Columns.Count-1)))接下來的i'如果粘貼範圍不為空,則警告用戶If NonEmptyCellCount <> 0然後_如果MsgBox(“是否覆蓋現有數據?”,vbQuestion + vbYesNo,_“複製多個選擇“] <> vbYes然後退出Sub'複製並粘貼每個區域,對於i = 1到NumAreas RowOffset = SelAreas(i)。行-TopRow ColOffset = SelAreas(i)。列-LeftCol SelAreas(i).Copy PasteRange.Offset( RowOffset,ColOffset)下一個i End Sub

3。 然後點擊 按鈕運行代碼。

4。 現在,請指定一個單元格以將範圍粘貼到開頭 複製多項選擇 對話框,然後單擊 OK 按鈕。 看截圖:


從一個工作表中快速復制多個選定範圍

複製多個範圍 的效用 Excel的Kutools 可以幫助您輕鬆快速地從活動工作表中復制多個範圍。 請執行以下操作:

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!

1。 選擇要一一使用的範圍,而無需按住 按Ctrl 鍵,然後單擊 庫工具 > 複製範圍。 看截圖:

2。 在 複製多個範圍 對話框,檢查 全部 選項 特殊粘貼 部分,然後單擊 好吧b烏頓。 參見上面的截圖:

注意: 如果要將行高和列寬保持在原始範圍內,請檢查 包括行高 選項和 包括列寬 複製多個範圍對話框中的選項。

3。 然後在以下提示框中指定一個單元格以粘貼範圍,然後單擊 OK 按鈕。

現在,所有選定範圍都將粘貼到指定單元格中,其行高和列寬與原始選擇的行高和列寬相同。

單擊此處以了解有關“複製多個範圍”實用程序的更多信息。       

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!


從許多工作表/工作簿中復制多個範圍

Kutools for Excel提供了另一個 合併工作表 該實用程序可在Excel中輕鬆地從多個工作表或多個工作簿中復制多個範圍。 請執行以下操作:

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!

1。 點擊 Kutools 加 > 結合.

2.在打開的合併工作表–第1步,共3對話框中,請檢查 將工作簿中的多個工作表合併為一個工作表 選項,然後單擊 下一頁 按鈕。

3。 在“合併工作表–第2步,共3步”對話框中,請執行以下操作:

(1)在 工作簿清單 部分,然後單擊 瀏覽 每個工作表後面的按鈕以指定每個工作表的範圍;
(2)點擊 加入 按鈕添加要從中復制範圍的其他工作簿,然後重複上述(1)以在添加的工作簿中指定範圍。
(3)點擊 按鈕。

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!

4。 然後出現一個Kutools for excel對話框,並要求保存組合方案。 請點擊 按鈕或 沒有 按鈕,根據需要。

到目前為止,已復制多個工作表或工作簿中的所有指定範圍,並將其粘貼到新工作簿中。


演示:從一個工作表中復制多個選定範圍

演示:從許多工作簿/工作表中復制多個選定範圍


Excel的Kutools:超過 300 個方便的工具觸手可及! 立即開始 30 天免費試用,沒有任何功能限制。 現在就下載!

最佳辦公生產力工具

🤖 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 (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi there,
Great code but wondered how I can paste values rather than just paste?
Thanks :)
This comment was minimized by the moderator on the site
Hi there,
Great post and the VBA code works perfectly. Is it possible to change the code to paste special > values? If so, how?
Thanks!
This comment was minimized by the moderator on the site
Hi. Nice code, works great. Is it possible to modify the code in a way such that it is possible to insert/paste the market row/ranges multiple times instead of just one time?
This comment was minimized by the moderator on the site
Hi Jacob,
Maybe this Insert Title Rows feature of Kutools for Excel can solve your problem.
https://www.extendoffice.com/product/kutools-for-excel/excel-insert-title-rows.html
This comment was minimized by the moderator on the site
Hi! How do I use the same VBA Code above but instead of simply pasting, I would like it to paste special for just the values. The table I am putting the values (constants) into is already formatted and with totals (formulas)
Thanks so much in advance!
This comment was minimized by the moderator on the site
Hi Katrina Manahan,

Please open the Microsoft Visual Basic for applications window, and create a new Module, just press CTRL + V to paste the VBA code directly. The sequence numbers before code won't be pasted.
This comment was minimized by the moderator on the site
Thanks for the code, works perfectly. This odd lack of function within Excel has stumped me many times in the past. It's normally quicker in the end to work around it, but in this case I have 4000 individually colour-coded cells so any work-around would have taken a long time, so I'm very grateful. Steve
This comment was minimized by the moderator on the site
Hi, Is it possible to adjust the code so that the copied cells can be pasted in another sheet? Now I get the error message "400" when I attempt this. I use Office 2010. Also, is it possible to copy so that empty lines are deleted? I have a big document and I copy some cells with hundreds of non-copied rows between them. This makes for a rather bulky output.
This comment was minimized by the moderator on the site
I found that if you have the Clipboard task plane open you can copy multiple rows simply using ctrl+C and paste them in order with crtl+V using Excel 2007.
This comment was minimized by the moderator on the site
Thank you SOOOOOO much - what a great site
This comment was minimized by the moderator on the site
Found above explanation of options to copy multiple ranges very helpful - thanks! I used the 'clipboard' option to copy multiple rows. Had to select each group of consecutive rows and copy it, move on and select next row or group of consecutive rows and copy it, etc.. But after this its easy, go to where you want to paste them, eg a new sheet, and click 'Paste all' from the Clipboard and all the rows are copied to there with out any gaps! Exactly what I wanted - thanks again!
This comment was minimized by the moderator on the site
I want to select the rows like 1, 5,6,10. so how can i copy these rows ???
This comment was minimized by the moderator on the site
In this case you can just select the rows and copy them as usual.
This comment was minimized by the moderator on the site
How can I copy cell a1, e5, g2, and so on.... (more than 1000 cells in same column) and paste them into b1, f5, h2 (right into the next column in same row.)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations