|
本帖最后由 chinagdzhao 于 2012-12-16 19:44 编辑
A B C D
1 12月1 5 30 593
2 12月2 26 15 156
3
4 合计 31 45 749
求助:
在A3输入日期后自动在A3下方插入空白行,网上找了很多例,但不会运用if..大家问的问题都不一样,感觉是挺简单的,就是不会VB
补充:
插入的新行'A4'也要有同样的功能,只要单元格非空就自动向下插入空行
再补充:
vba的代码已经有了,在新建的表格里面基本可以实现,但原来的表格中使用出现错误(是不是列表的问题?),附上附件,里面有表1和表2,大家帮我想想办法
- Private Sub Worksheet_Change(ByVal Target As Range)
- Application.EnableEvents = False
- If Target.Count = 1 And Target.Column = 1 Then
- If Target <> "" And Target.Row = Cells.Find("*", , , , 1, 2).Row - 1 Then
- Rows(Target.Row).Insert
- Target.EntireRow.Copy Target.Offset(-1, 0)
- Target.EntireRow.ClearContents
- End If
- End If
- Application.EnableEvents = True
- End Sub
复制代码
|
|