|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
之前大神为我写了工作中要遇到的难题VBA来解决,可我小白VBA,不会改他的代码,我试了好几次,也没改好,希望大家帮我改下,谢谢。
大神写的代码:
Option Explicit
Sub test1()
Dim ar, br(1 To 10000, 1 To 3) As String
Dim i As Long, j As Integer, k As Long, n As Integer
ar = Range("A1").CurrentRegion.Offset(1)
For i = 1 To UBound(ar) - 1
For n = 1 To ar(i, 5)
k = k + 1
For j = 1 To 3
br(k, j) = ar(i, j)
Next
Next
Next
With Range("H1")
.CurrentRegion.Clear
With .Resize(k, UBound(br, 2))
.Value = br
.Borders.LineStyle = xlContinuous
.HorizontalAlignment = xlCenter
End With
End With
Beep
End Sub
|
|