0
我在A列中的村莊 - 城堡,J列中的各個地區名稱屬於村莊。我想將所有以逗號分隔的vilalge-urls轉換爲列R execpt列A中的值。轉置應根據比較值J(Dist)完成。基於參考值轉置數據,然後從輸出中減去文本
So every R2=R2-A2
宏應該適用於所有工作表。
輸入:
柱A值:
URL
<a href="https://D.COM/Campbelbay" >Campbelbay</a>,
<a href="https://D.COM/Carnicobar" >Carnicobar</a>,
<a href="https://D.COM/Champin" >Champin</a>,
<a href="https://D.COM/Aerial-Bay" >Aerial Bay</a>,
<a href="https://D.COM/Bakultala" >Bakultala</a>,
<a href="https://D.COM/Betapur" >Betapur</a>,
<a href="https://D.COM/Diglipur" >Diglipur</a>,
<a href="https://D.COM/Aberdeen-Bazar" >Aberdeen Bazar</a>,
<a href="https://D.COM/Bambooflat" >Bambooflat</a>,
<a href="https://D.COM/Beachdera" >Beachdera</a>,
<a href="https://D.COM/Beodnabad" >Beodnabad</a>,
J列值:
DISTRICT
Nicobar
Nicobar
Nicobar
North And Middle Andaman
North And Middle Andaman
輸出:
MERGEDURL
<a href="https://D.COM/Carnicobar" >Carnicobar</a>,<a href="https://D.COM/Champin" >Champin</a>,<a href="https://D.COM/Aerial-Bay" >Aerial Bay</a>,<a href="https://D.COM/Bakultala" >Bakultala</a>
<a href="https://D.COM/Campbelbay" >Campbelbay</a>,<a href="https://D.COM/Champin" >Champin</a>,<a href="https://D.COM/Aerial-Bay" >Aerial Bay</a>,<a href="https://D.COM/Bakultala" >Bakultala</a>
<a href="https://D.COM/Campbelbay" >Campbelbay</a>,<a href="https://D.COM/Carnicobar" >Carnicobar</a>,<a href="https://D.COM/Aerial-Bay" >Aerial Bay</a>,<a href="https://D.COM/Bakultala" >Bakultala</a>
<a href="https://D.COM/Campbelbay" >Campbelbay</a>,<a href="https://D.COM/Carnicobar" >Carnicobar</a>,<a href="https://D.COM/Champin" >Champin</a>,<a href="https://D.COM/Bakultala" >Bakultala</a>
<a href="https://D.COM/Campbelbay" >Campbelbay</a>,<a href="https://D.COM/Carnicobar" >Carnicobar</a>,<a href="https://D.COM/Champin" >Champin</a>,<a href="https://D.COM/Aerial-Bay" >Aerial Bay</a>
宏用於合併:
Sub Transpose()
Dim w As Excel.Worksheet
Dim r As Excel.Range
For Each w In ThisWorkbook.Worksheets
Set r = w.Range("a2", w.Range("a1").End(xlDown))
w.Range("q1").Value = Join(Application.Transpose(r), ",")
Next w
末次
感謝您的時間。
信貸和Refrence宏:VBA Provided by Imran Malek:
Substitute Text macro provided here by Lee
謝謝李,再次你在我的幫助。我想根據列J中的對應值將列A值合併並添加到列R.因此,J中的值發生變化,然後合併列A中的相應值開始新跳過列A中的相應單元格值,並將結果添加到列R. – Ram