|
楼主 |
发表于 2010-6-5 08:47
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
已上传附件!(顶楼)
Sub Macro1()
Dim dh_num, dh_col, sj_col As Integer
Dim bottom As Range
Dim tail As Range
dh_col = Selection.Column
sj_col = Selection.Column + Selection.Columns.Count - 1
Set bottom = Range(Cells(65536, dh_col), Cells(65536, dh_col)).End(xlUp)
Sheets("sheet1").Select
Range("a1").Select
dh_num = Range("a65536").End(xlUp).Row - 2
Set tail = Range("iv2").End(xlToLeft).Offset(0, 1)
tail.Formula = "=成果表1!R8C" & sj_col - 1
tail.Select
Selection.NumberFormatLocal = "yyyy-m-d"
For i = 1 To dh_num
tail.Offset(i).Formula = "=vlookup(A" & i + 2 & ",成果表1!R1C" & dh_col & ":R" & bottom.Row & "C" & sj_col & "," & sj_col - dh_col & ",0)"
Next i
End Sub
[ 本帖最后由 yanhzs 于 2010-6-5 08:49 编辑 ] |
|