|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
”信息表“保持活动窗口,但是你的按钮在“录入”工作簿,无法点按钮了。我理解你可能想点击按钮后,转到”信息表“,修改后自动保存,不再提示,按这个想法改了一下。
Sub 录入()
Dim cs$, rq, Arr, csArr, m&, col%, yf$, dd
Dim wb As Workbook
Application.DisplayAlerts = False
'Workbooks.Open ThisWorkbook.Path & "\信息表.xlsx"
Set wb = Workbooks("信息表.xlsx")
cs = ThisWorkbook.Sheets("Sheet1").[e5].Value: rq = ThisWorkbook.Sheets("Sheet1").[g11].Value
Arr = ThisWorkbook.Sheets("Sheet1").[g13:g16]
wb.Activate
csArr = Array("上海", "北京", "南京", "新疆石河子")
m = Application.Match(cs, csArr, 0) - 1
col = 5 * m + 2
yf = Month(rq) & "月份": dd = Day(rq) + 6
With wb.Sheets(yf)
.Cells(dd, col + 1).Resize(1, 4) = Application.Transpose(Application.Index(Arr, 0, 1))
End With
wb.Save
MsgBox "数据已保存"
Application.DisplayAlerts = True
End Sub
|
|