If cell A4 has a value of 0. I am looking for the entire row to be deleted. Please help:( :(
M mikespeck Jul 24, 2006 #1 If cell A4 has a value of 0. I am looking for the entire row to be deleted. Please help
V VBA Noob Jul 24, 2006 #2 You will need VBA Code Try this. Press Alt + F11. Insert module then paste in the below code. Press alt F8 and run Delete_row. See attched to make it a event procedure e.g If someone enters 0 in cell A4 it will delete row automatically http://www.cpearson.com/excel/events.htm Sub Delete_row() Dim Rng1 As Range Set Rng1 = Range("A4") If Rng1.Value = 0 Then Rows("4:4").Delete Shift:=xlUp End If End Sub VBA Noob
You will need VBA Code Try this. Press Alt + F11. Insert module then paste in the below code. Press alt F8 and run Delete_row. See attched to make it a event procedure e.g If someone enters 0 in cell A4 it will delete row automatically http://www.cpearson.com/excel/events.htm Sub Delete_row() Dim Rng1 As Range Set Rng1 = Range("A4") If Rng1.Value = 0 Then Rows("4:4").Delete Shift:=xlUp End If End Sub VBA Noob
S Sasa Stankovic Jul 24, 2006 #3 or: in VBA: Sub row() If Range("A4").Value = 0 Then Selection.EntireRow.Delete ActiveCell.Offset(RowOffset:=-1, ColumnOffset:=0) End If End Sub
or: in VBA: Sub row() If Range("A4").Value = 0 Then Selection.EntireRow.Delete ActiveCell.Offset(RowOffset:=-1, ColumnOffset:=0) End If End Sub
M mikespeck Jul 25, 2006 #4 nothing seemed to work. If a 0 is in A4 I need to at least have the contents of cell A4,B4,C4,D4,E4,F4 be deleted also. :confused
nothing seemed to work. If a 0 is in A4 I need to at least have the contents of cell A4,B4,C4,D4,E4,F4 be deleted also. :confused