需要编程处理哦
EPIe1Hgy.rar
(19.71 KB, 下载次数: 58)
,代码如下:
Private Sub CommandButton1_Click() '经常用的数组方法,提高代码运行速度
Dim arr '有好的方法,尽量都用好方法,虽然写起来麻烦一点点
Dim arr1()
Dim irow%, i%
Dim Im%
Dim c As Range, c1 As Range
Application.ScreenUpdating = False
irow = [d65536].End(xlUp).Row
arr = Range("d2:d" & irow)
ReDim arr1(1 To irow - 1, 0)
For i = 1 To irow - 1
Set c = Sheets("数据源").Cells.Find(arr(i, 1), lookat:=xlPart) '按部分查找
If Not c Is Nothing Then '如果找到了
Set c1 = c.End(xlUp)
arr1(i, 0) = IIf(InStr(1, c1, "其他合同"), c1.Offset(0, 1), c1.Offset(0, -1)) & _
"/" & c.Offset(0, -1)
End If
Next
Range("e2").Resize(irow - 1, 1) = arr1
Application.ScreenUpdating = True
End Sub
[此贴子已经被作者于2005-9-1 16:38:06编辑过] |