返回列表 上一主題 發帖

[發問] 關於 串連字串 & 大量串連在同一儲存格

回復 4# starry1314
PHONETIC函數只能用在文字,儲存格內容為公式、數值皆無法使用
而內建字串函數並無處理類似大範圍的串連函數
必須以VBA輔助方可達成
若不使用VBA那麼以你所舉例子,只要將B2:C3儲存格複製,選擇性貼上/值,然後用PHONETIC函數即可
D1=PHONETIC(B2:C3)

另提供基本操作複製貼上動畫供您參考
play.gif
學海無涯_不恥下問

TOP

回復 6# starry1314
VBA寫個自訂函數增益集來解決大範圍儲存格內容
將檔案解壓縮到OFFICE增益集目錄
C:\Users\[Username]\AppData\Roaming\Microsoft\AddIns
載入ConnectStr.xla增益集
就能在電腦中使用該函數

ConnectStr.zip (8.82 KB)
  1. Function ConnectStr(Rng As Range, dot As String) 'Rng為連儲存格範圍,dot為連結符號
  2. Dim Ay(), i&, s&
  3. ar = Rng.Value
  4. For i = 1 To UBound(ar, 1)
  5. For Each a In Application.Transpose(Application.Index(ar, i))
  6.    If a <> "" Then
  7.       mystr = IIf(mystr = "", a, mystr & a & dot)
  8.    End If
  9. Next
  10.    ReDim Preserve Ay(s)
  11.    Ay(s) = mystr
  12.    mystr = ""
  13.    s = s + 1
  14. Next
  15. ConnectStr = Join(Ay, dot)
  16. End Function
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 謊言像一朵盛開的鮮花,外表美麗,生命短暫。
返回列表 上一主題