Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey guys,
I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Press Alt + F11 to open the VB editor, If the window is dark, use
InsertModule and then paste the code below into the window. You can run the code from Excel by clicking ToolsMacroMacrosRun. Make sure this macro is in the top window of the dialogue box. Sub delRws() If Range("AD5") = 0 And Range("AD43") = 0 _ And Range("AD50") = 0 Then Set delRng = Application.Union(Rows(5), Rows(43), Rows(50)) delRng.EntireRow.Delete End If End Sub "JC" wrote: Hey guys, I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
JLGWhiz,
Can we make this say that anywhere in Column AD there is a zero, delete that corresponding row?? "JLGWhiz" wrote: Press Alt + F11 to open the VB editor, If the window is dark, use InsertModule and then paste the code below into the window. You can run the code from Excel by clicking ToolsMacroMacrosRun. Make sure this macro is in the top window of the dialogue box. Sub delRws() If Range("AD5") = 0 And Range("AD43") = 0 _ And Range("AD50") = 0 Then Set delRng = Application.Union(Rows(5), Rows(43), Rows(50)) delRng.EntireRow.Delete End If End Sub "JC" wrote: Hey guys, I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this
Sub delete_Me() lastrow = Range("AD65536").End(xlUp).Row For x = lastrow To 1 Step -1 If Cells(x, 30).Value < "" Then If Cells(x, 30).Value = 0 Then Rows(x).Delete End If End If Next End Sub Mike "JC" wrote: JLGWhiz, Can we make this say that anywhere in Column AD there is a zero, delete that corresponding row?? "JLGWhiz" wrote: Press Alt + F11 to open the VB editor, If the window is dark, use InsertModule and then paste the code below into the window. You can run the code from Excel by clicking ToolsMacroMacrosRun. Make sure this macro is in the top window of the dialogue box. Sub delRws() If Range("AD5") = 0 And Range("AD43") = 0 _ And Range("AD50") = 0 Then Set delRng = Application.Union(Rows(5), Rows(43), Rows(50)) delRng.EntireRow.Delete End If End Sub "JC" wrote: Hey guys, I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank-You!!!!
"Mike H" wrote: Maybe this Sub delete_Me() lastrow = Range("AD65536").End(xlUp).Row For x = lastrow To 1 Step -1 If Cells(x, 30).Value < "" Then If Cells(x, 30).Value = 0 Then Rows(x).Delete End If End If Next End Sub Mike "JC" wrote: JLGWhiz, Can we make this say that anywhere in Column AD there is a zero, delete that corresponding row?? "JLGWhiz" wrote: Press Alt + F11 to open the VB editor, If the window is dark, use InsertModule and then paste the code below into the window. You can run the code from Excel by clicking ToolsMacroMacrosRun. Make sure this macro is in the top window of the dialogue box. Sub delRws() If Range("AD5") = 0 And Range("AD43") = 0 _ And Range("AD50") = 0 Then Set delRng = Application.Union(Rows(5), Rows(43), Rows(50)) delRng.EntireRow.Delete End If End Sub "JC" wrote: Hey guys, I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mike's code should do that.
"JC" wrote: JLGWhiz, Can we make this say that anywhere in Column AD there is a zero, delete that corresponding row?? "JLGWhiz" wrote: Press Alt + F11 to open the VB editor, If the window is dark, use InsertModule and then paste the code below into the window. You can run the code from Excel by clicking ToolsMacroMacrosRun. Make sure this macro is in the top window of the dialogue box. Sub delRws() If Range("AD5") = 0 And Range("AD43") = 0 _ And Range("AD50") = 0 Then Set delRng = Application.Union(Rows(5), Rows(43), Rows(50)) delRng.EntireRow.Delete End If End Sub "JC" wrote: Hey guys, I need to create a macro and i've never done this...i think that this is a simple macro to build, just need a little help... I need to build a macro that will delete an entire row when a particular column =zero....Example... If cell AD5, AD43 and AD 50 equal zero, i want the macro to delete row 5, 43 and 50. Thanks!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a macro which presses a button containing a recorded macro | Excel Programming | |||
Creating a Macro | Excel Programming | |||
Creating a Macro | Excel Programming | |||
Creating a macro | Excel Worksheet Functions | |||
help creating a macro | Excel Programming |