Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jc jc is offline
external usenet poster
 
Posts: 164
Default Creating a macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Creating a macro

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   Report Post  
Posted to microsoft.public.excel.programming
jc jc is offline
external usenet poster
 
Posts: 164
Default Creating a macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Creating a macro

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   Report Post  
Posted to microsoft.public.excel.programming
jc jc is offline
external usenet poster
 
Posts: 164
Default Creating a macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Creating a macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a macro which presses a button containing a recorded macro petros89[_3_] Excel Programming 3 October 5th 05 02:49 PM
Creating a Macro Galumpher Excel Programming 3 September 2nd 05 07:20 PM
Creating a Macro DeRizzio[_2_] Excel Programming 10 March 26th 05 01:37 PM
Creating a macro Macro Insite Excel Worksheet Functions 3 November 25th 04 11:08 PM
help creating a macro ale700 Excel Programming 3 July 6th 04 05:37 AM


All times are GMT +1. The time now is 03:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"