Skip to main content

如何在 Excel 中快速將地址列表從行轉置為列?

Author: Sun Last Modified: 2025-05-12

例如,您有一個包含姓名和地址的單一列表,需要將其轉換為列,如下方截圖所示。Excel 並沒有內建的功能來實現這一點,但本文介紹了一些快速解決此問題的方法。
A screenshot showing an address list transposed from rows to columns in Excel

使用 VBA 轉置地址列表

使用 Kutools for Excel 轉置地址列表good idea3


使用 VBA 轉置地址列表

要將地址列表從行轉置為列,您可以應用一段 VBA 程式碼。

1. 打開包含要轉置數據的工作表,然後按下 Alt + F11 鍵以打開 Microsoft Visual Basic for Applications 視窗。

2. 點擊 插入 > 模組,並將以下巨集程式碼粘貼到模組中。參見截圖:

VBA:轉置地址列表

Sub fixText()
'UpdatebyExtendoffice0170905
    Dim I As Integer
    Dim K As Integer
    Dim xRgS As Range
    Dim xRgD As Range
    Dim xAddress As String
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRgS = Application.InputBox("Select a range to transpose:", "KuTools For Excel", xAddress, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Select a cell to place result", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    xRgD(1).Offset(, 0).Value = "Name"
    xRgD(1).Offset(, 1).Value = "Address"
    xRgD(1).Offset(, 2).Value = "City/State"
    K = 1
    For I = 1 To xRgS.Rows.Count
        xRgD(1).Offset(K).Value = xRgS(I).Value
        xRgD(1).Offset(K, 1).Value = xRgS(I + 1).Value
        xRgD(1).Offset(K, 2).Value = xRgS(I + 2).Value
        K = K + 1
        I = I + 2
    Next
End Sub

A screenshot of the VBA editor with the pasted macro code

3. 按下 F5 鍵運行程式碼,會彈出一個對話框提醒您選擇要使用的數據區域。參見截圖:
A screenshot of the dialog for selecting the range to transpose in Excel

4. 點擊 確定,然後在下一個彈出的對話框中,選擇一個單元格放置轉置結果。參見截圖:
A screenshot of the dialog for selecting a cell to place the transposed result

5. 點擊 確定。現在單一列表已經被轉置成列了。
A screenshot showing an address list transposed from rows to columns


使用 Kutools for Excel 轉置地址列表

如果您有 Kutools for Excel,可以應用 轉換區域 功能快速將地址列表轉置為列。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 選擇要轉置的數據,點擊 Kutools > 區域 > 轉換區域。參見截圖:
A screenshot showing the Transform Range option in Kutools tab in Excel

2. 在彈出的對話框中,勾選 轉換類型 區域中的 單列轉區域 選項,並勾選 固定值 選項,在右側文本框中輸入所需的數字。參見截圖:
A screenshot of the Transform Range dialog with options to transpose data from a single column to a range

3. 點擊 確定,並選擇一個單元格放置轉置結果。參見截圖:
A screenshot of the Kutools dialog for selecting a cell to place the transposed result

4. 點擊 確定。地址列表已被轉置。
A screenshot showing an address list transposed from rows to columns

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

示範:使用 Kutools for Excel 轉置地址列表

Kutools for Excel:超過 300 種實用工具任您使用!永久免費享受AI功能!立即下載!

最佳辦公效率工具

🤖 Kutools AI 助手:基於智能執行方式革新數據分析:智能執行   |  生成代碼  |  創建自訂公式  |  分析數據並生成圖表  |  調用 Kutools 函數
熱門功能查找、標記重複值或識別重複項   |  刪除空行   |  合併列或單元格而不丟失數據   |   四捨五入無需公式 ...
高級 LOOKUP多條件 VLookup    多值 VLookup  |   多表查找   |   模糊查找 ....
高級下拉列表快速創建下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
列管理器添加特定數量的列  |  移動列  |  切換隱藏列的可見狀態  |  比較區域和列 ...
特色功能網格聚焦   |  設計檢視   |   增強編輯欄    工作簿與工作表管理器   |  資源庫(自動文本)   |  日期提取器   |  合併資料   |  加密/解密儲存格    按列表發送電子郵件   |  超級篩選   |   特殊篩選(篩選粗體/斜體/刪除線...) ...
頂級 15 種工具集12 個文本工具添加文本刪除特定字符、...)   |   50+ 圖表 類型甘特圖、...)   |   40+ 實用 公式基於生日計算年齡、...)   |   19 個插入工具插入QR碼根據路徑插入圖片、...)   |   12 個轉換工具金額轉大寫匯率轉換、...)   |   7 個合併與分割工具高級合併行分割儲存格、...)   |   ... 還有更多

使用 Kutools for Excel 提升您的 Excel 技巧,體驗前所未有的高效。 Kutools for Excel 提供超過 300 種高級功能來提高生產力並節省時間。  點擊這裡獲取您最需要的功能...


Office Tab 將標籤式界面帶到 Office,讓您的工作更加輕鬆

  • 在 Word、Excel、PowerPoint、Publisher、Access、Visio 和 Project 中啟用標籤式編輯和閱讀。
  • 在同一窗口的新標籤中打開和創建多個文檔,而不是在新窗口中。
  • 將您的生產力提高 50%,每天為您減少數百次鼠標點擊!