Dim mSht As Worksheet
Dim mArr()
Dim s%, m%, r%
Dim mRng
Set mSht = Worksheets("Test")
With mSht
mRng = .Range("a1:g10989")
r = UBound(mRng, 1)
For s = 1 To r
ReDim Preserve mArr(m)
mArr(m) = Trim(Join(Application.WorksheetFunction.Index(mRng, s)))
m = m + 1
Next
mArr = Application.Transpose(mArr)
.Range("h1").Resize(m) = mArr
.Range("h1") = "合併簽審"
End With
End Sub
感恩大大!作者: oobird 時間: 2011-2-6 20:47
改這樣會快得多
Sub pp()
Dim mSht As Worksheet
Dim d As Object, arr
Dim s%, m%, r%
Dim mRng
Set d = CreateObject("Scripting.Dictionary")
Set mSht = Worksheets("Test")
With mSht
mRng = .Range("a1:g10988")
r = UBound(mRng, 1)
For s = 1 To r
arr = Array(mRng(s, 1), mRng(s, 2), mRng(s, 3), mRng(s, 4), mRng(s, 5), mRng(s, 6), mRng(s, 7))
MyCom = Join(arr)
d(s) = MyCom
Next
.Range("h1").Resize(r) = Application.Transpose(d.items)
.Range("h1") = "合併簽審"
End With
End Sub作者: dechiuan999 時間: 2011-2-6 21:16
oobird版主大大新年好:
小弟改用版主大大提供的語法,
可說是超快速的,簡直無法讓人想象。
更令小弟驚呀的是大大引用dictionary
是如此的神奇。
For s = 1 To r
arr = Array(mRng(s, 1), mRng(s, 2), mRng(s, 3), mRng(s, 4), mRng(s, 5), mRng(s, 6), mRng(s, 7))
MyCom = Trim(Join(arr))
d(s) = MyCom
Next