|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim rng As Range
- With Worksheets("保存")
- ks = .Range("e5")
- arr = .Range("g12:g17")
- yf = Application.Choose(Month(arr(1, 1)), "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二") & "月份"
- ts = Day(arr(1, 1))
- End With
- With Worksheets("人员卡片")
- Set rng = .Columns(1).Find(what:=yf, LookIn:=xlValues, lookat:=xlWhole)
- If rng Is Nothing Then
- MsgBox "没有该月份数据!"
- Exit Sub
- End If
- r = rng.Row - 2
- Set rng = .Rows(r).Find(what:=ks, LookIn:=xlValues, lookat:=xlWhole)
- If rng Is Nothing Then
- MsgBox "没有该科室数据!"
- Exit Sub
- End If
- c = rng.Column
- .Cells(r + ts + 1, c + 1) = arr(3, 1)
- .Cells(r + ts + 1, c + 2) = arr(5, 1)
- .Cells(r + ts + 1, c + 3) = arr(4, 1)
- .Cells(r + ts + 1, c + 4) = arr(6, 1)
-
- End With
- End Sub
复制代码 |
|