Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro required

Can someone tell me how to build a macro to do the following.
Starting at c1 check to see if there is a zero: if it IS a zero
delete the entire line
Now drop down one line to C2 and do the same and if it NOT a zero,
jump to the next line
carry on doing that until the end of any data
Thanks
Ian M
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Macro required

Hi Ian,

Am Tue, 1 May 2012 13:01:04 -0700 (PDT) schrieb pcorcele:

Can someone tell me how to build a macro to do the following.
Starting at c1 check to see if there is a zero: if it IS a zero
delete the entire line
Now drop down one line to C2 and do the same and if it NOT a zero,
jump to the next line
carry on doing that until the end of any data


try:

Sub DeleteRows()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = LRow To 1 Step -1
If Cells(i, 3) = 0 Then
Rows(i).Delete
End If
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro required

On May 1, 4:57*pm, Claus Busch wrote:
Hi Ian,

Am Tue, 1 May 2012 13:01:04 -0700 (PDT) schrieb pcorcele:

Can someone tell me how to build a macro to do the following.
Starting at *c1 check to see if there is a zero: if it IS a zero
delete the entire line
Now drop down one line to C2 and do the same *and if it NOT a zero,
jump to the next line
carry on doing that until the end of any data


try:

Sub DeleteRows()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = LRow To 1 Step -1
* * If Cells(i, 3) = 0 Then
* * * * Rows(i).Delete
* * End If
Next
End Sub

Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


Thanks very much..it worked very well...actually much to well....Can
you tell me how to modify the code in order that the delete would only
take place is the VALUE is zero and not delete is the cell is BLANK
Thanks Again
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Macro required

Hi Ian,

Am Tue, 1 May 2012 16:09:38 -0700 (PDT) schrieb pcorcele:

Thanks very much..it worked very well...actually much to well....Can
you tell me how to modify the code in order that the delete would only
take place is the VALUE is zero and not delete is the cell is BLANK


a blank cell has the value 0
Try:
Sub DeleteRows()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = LRow To 1 Step -1
If Cells(i, 3) = 0 And Len(Cells(i, 3)) = 1 Then
Rows(i).Delete
End If
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro required

On May 1, 7:16*pm, Claus Busch wrote:
Hi Ian,

Am Tue, 1 May 2012 16:09:38 -0700 (PDT) schrieb pcorcele:

Thanks very much..it worked very well...actually much to well....Can
you tell me how to modify the code in order that the delete would only
take place is the VALUE is zero and not delete is the cell is BLANK


a blank cell has the value 0
Try:
Sub DeleteRows()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = LRow To 1 Step -1
* * If Cells(i, 3) = 0 And Len(Cells(i, 3)) = 1 Then
* * * * Rows(i).Delete
* * End If
Next
End Sub

Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


P E R F E C T
Thanks
Ian M
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
Macro required please Dr Hackenbush Excel Discussion (Misc queries) 4 February 10th 10 09:29 AM
MACRO REQUIRED ZEESHAN Excel Discussion (Misc queries) 1 August 21st 09 01:28 PM
Macro Required.... kiran Excel Programming 7 March 3rd 09 06:21 AM
Macro help required ! [email protected] Excel Programming 3 December 15th 08 08:23 AM
Pilgrim needs help: Effecting keystroks required by a macro nested within a macro. [email protected] Excel Programming 1 May 14th 05 03:46 AM


All times are GMT +1. The time now is 01:34 AM.

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

About Us

"It's about Microsoft Excel"