我想知道是否可以创建一个宏,它会将复制范围内的每个单元格多次(x)粘贴到一列中。
EG。我们有像这样的形式的数据
一个
b
ç
...
我们需要(例如x = 4)
一个
一个
一个
一个
b
b
b
b
ç
ç
ç
ç
答案 0 :(得分:0)
请尝试这个:
Sub pCreateMultipleTimes()
Dim strText As String
Dim strOutput As String
Dim intMultiplier As Integer
Dim varTempData As Variant
Dim lngLoop1 As Long
Dim lngLoop2 As Long
'Considering data to be in form so it will be in text
strText = "a b c"
' x=4
intMultiplier = 4
'Split Text with space as delimiter and assign it to Variant
varTempData = Split(strText, " ")
'Loop through to create the final combination output
For lngLoop1 = LBound(varTempData) To UBound(varTempData)
For lngLoop2 = 1 To intMultiplier
strOutput = Trim(strOutput & " " & varTempData(lngLoop1))
Next lngLoop2
Next lngLoop1
MsgBox "Your needed Output is: " & strOutput, vbOKOnly + vbInformation
End Sub