|
本帖最后由 这儿有肥猫 于 2014-10-10 22:36 编辑
- Sub a()
- Dim arr, i As Range, j&
- arr = Sheets("数据").Range("b2:b" & Sheets("数据").Cells(Rows.Count, 2).Row)
- Set i = Sheets("存放").Rows(1).Find(Sheets("数据").[b1], lookat:=xlWhole)
- With Sheets("存放")
- j = .Cells(1, Columns.Count).End(xlToLeft).Column
- If Not i Is Nothing Then
- .Range(Cells(2, i.Column), Cells(.Cells(Rows.Count, i.Column).End(3).Row, i.Column)).ClearContents
- .Cells(2, i.Column).Resize(UBound(arr), 1) = arr
-
- Else
- .Cells(1, j + 1) =Sheets("数据").[b1]
- .Cells(2, j + 1).Resize(UBound(arr), 1) = arr
-
- End If
- End With
- End Sub
复制代码 |
|