ParamArrays
을 사용하면 원하는만큼 많은 인수를 전달할 수 있습니다.
Substitute Range("A1"), "find1", "replace1", "find2", "replace2", "find3", "replace3"
: 다음과 같이 보일 것입니다, 그것을 호출 이제
' patternReplacements are expected to have an even number of arguments.
' The even param (0, 2, etc) would be the search text and the odd (1, 3, etc) the respective replacement text.
Public Sub Substitute(ByVal cell As Range, ParamArray patternReplacements() As Variant)
Dim text As String
text = cell.Value
' Perform text replacements.
' Note - No logic here ensures an even number of arguments are passed, this could be easily added though.
Dim i As Integer
For i = 0 To UBound(patternReplacements) Step 2
text = Replace(text, patternReplacements(i), patternReplacements(i + 1))
Next
cell.Value = text
End Sub
: 여기에서 사용자 정의 로직을 수행하기 위해 배열의 값을 해석