|
本帖最后由 mick456 于 2014-10-21 18:50 编辑
请大家帮忙,看看要怎么做呢,谢谢大家
- Sub 添加()
- With Sheet4
- r = .[a65536].End(3).Row + 1
- .Cells(r, 1).Resize(1, 24) = Application.Transpose([c2:c25])
- .Cells(r, "Y").Resize(1, 24) = Application.Transpose([f2:f25])
- .Cells(r, "aw").Resize(1, 16) = Application.Transpose([h2:h17])
- .Cells(r, "G") = "'" & [c8]
- MsgBox "一条记录已添加"
- End With
- End Sub
- Sub 查询()
- With Sheet4
- r = .[a65536].End(3).Row + 1
- For i = 7 To r
- If .Cells(i, "G") = [c8] Or .Cells(i, "F") = [c7] Then
- [c2:c25] = Application.Transpose(.Cells(i, 1).Resize(1, 24))
- [f2:f25] = Application.Transpose(.Cells(i, "Y").Resize(1, 24))
- [h2:h17] = Application.Transpose(.Cells(i, "aw").Resize(1, 16))
- [c8] = "'" & .Cells(i, "G")
- Exit Sub
- End If
- Next
- End With
- MsgBox "无此记录"
- End Sub
- Sub 修改()
- With Sheet4
- r = .[a65536].End(3).Row + 1
- For i = 7 To r
- If .Cells(i, "G") = [c8] Or .Cells(i, "F") = [c7] Then
- .Cells(i, 1).Resize(1, 24) = Application.Transpose([c2:c25])
- .Cells(i, "Y").Resize(1, 24) = Application.Transpose([f2:f25])
- .Cells(i, "aw").Resize(1, 16) = Application.Transpose([h2:h17])
- .Cells(i, "G") = "'" & [c8]
- MsgBox "修改已完成"
- Exit Sub
- End If
- Next
- End With
- MsgBox "无此记录"
- End Sub
复制代码
|
|