benishiryo
Board Regular
- Joined
- Feb 13, 2011
- Messages
- 116
Hi guys, i'm doing this macro that will insert rows for those I want to. Basically it's those rows after the subtotals.
My file looks somethin like this & I would have a formula which reads "Insert Rows" so I can filter them, select visible cells & insert:
Mth ACC Remarks TOTAL
Jul-10 A 50
Jul-10 A 30
A Total 80
Jul-10 B Insert row 25
B Total 25
Jul-10 C 75
Jul-10 C 10
C Total 85
The VBA for the filtering & deleting:
Selection.AutoFilter Field:=4, Criteria1:="Insert Row"
Rows("4:10").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Insert Shift:=xlDown
The error that appeared:
Run-time error '1004':
Insert method of Range class failed
Appreciate if u guys can explain to me what I can do differently with the recording of the macro rather than just provide the VBA solution. cos I am very unfamiliar with vba.
Thks!
My file looks somethin like this & I would have a formula which reads "Insert Rows" so I can filter them, select visible cells & insert:
Mth ACC Remarks TOTAL
Jul-10 A 50
Jul-10 A 30
A Total 80
Jul-10 B Insert row 25
B Total 25
Jul-10 C 75
Jul-10 C 10
C Total 85
The VBA for the filtering & deleting:
Selection.AutoFilter Field:=4, Criteria1:="Insert Row"
Rows("4:10").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Insert Shift:=xlDown
The error that appeared:
Run-time error '1004':
Insert method of Range class failed
Appreciate if u guys can explain to me what I can do differently with the recording of the macro rather than just provide the VBA solution. cos I am very unfamiliar with vba.
Thks!