Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Duster142
 
Posts: n/a
Default Macro Creating


I have tried and tried to create a MACRO in Excel that will will delete
a row. I have read several other marcos but have been unable to
translate them to what I want to do. Listed below a sample of the type
data I am talking about. What I want to do is have the macro read the
second number in the colum and everytime it read a 0 it deletes that
whole line of information. This type table will have some blank row
but I do not want to delete. Can anyone help. Thanks in advance. Ron


D60801 0 0 0 0 0
D78555 0 0 0 0 0
E98103 0 0 0 0 0
N04456 0 0 0 0 0
N05482 3 60 0 0 0
N95862 0 0 0 0 0
N96248 3 8.25 0 0 0


R59160 0 0 0 0 0
R67908 0 0 0 0 0
R67976 0 0 0 0 0
R68044 3 204 0 0 0


--
Duster142
------------------------------------------------------------------------
Duster142's Profile: http://www.excelforum.com/member.php...o&userid=27738
View this thread: http://www.excelforum.com/showthread...hreadid=472470

  #2   Report Post  
Gary''s Student
 
Posts: n/a
Default

Try:

Sub Macro1()
Dim i As Long
For i = 13 To 1 Step -1
Rows(i).Select
If IsEmpty(Cells(i, 2)) Then
Else
If Cells(i, 2) = 0 Then
Selection.Delete
End If
End If
Next
End Sub

Change the 13 to reflect your actual table size.
--
Gary''s Student


"Duster142" wrote:


I have tried and tried to create a MACRO in Excel that will will delete
a row. I have read several other marcos but have been unable to
translate them to what I want to do. Listed below a sample of the type
data I am talking about. What I want to do is have the macro read the
second number in the colum and everytime it read a 0 it deletes that
whole line of information. This type table will have some blank row
but I do not want to delete. Can anyone help. Thanks in advance. Ron


D60801 0 0 0 0 0
D78555 0 0 0 0 0
E98103 0 0 0 0 0
N04456 0 0 0 0 0
N05482 3 60 0 0 0
N95862 0 0 0 0 0
N96248 3 8.25 0 0 0


R59160 0 0 0 0 0
R67908 0 0 0 0 0
R67976 0 0 0 0 0
R68044 3 204 0 0 0


--
Duster142
------------------------------------------------------------------------
Duster142's Profile: http://www.excelforum.com/member.php...o&userid=27738
View this thread: http://www.excelforum.com/showthread...hreadid=472470


  #3   Report Post  
Duster142
 
Posts: n/a
Default


Thank you Gary,

What I found that I had to do to the script you provided was to add "
around the 0 and then it worked like a charm. You will never no how
much time this little Macro is going to save myself and three others
that work with me.

If Cells(i, 2) = 0 Then


If Cells(i, 2) = "0" Then

Thanks a million,


Ron


--
Duster142
------------------------------------------------------------------------
Duster142's Profile: http://www.excelforum.com/member.php...o&userid=27738
View this thread: http://www.excelforum.com/showthread...hreadid=472470

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 to save only partial data Jparsons Excel Discussion (Misc queries) 0 September 24th 05 10:50 AM
creating a macro for a "Save As" box MysticMarley Excel Discussion (Misc queries) 2 August 9th 05 02:31 AM
Creating a macro Gene Goldenfeld New Users to Excel 10 May 5th 05 04:28 PM
Creating a macro in excel Not sure what I am doing Excel Worksheet Functions 1 March 25th 05 11:04 PM
Creating a macro Macro Insite Excel Worksheet Functions 3 November 25th 04 11:08 PM


All times are GMT +1. The time now is 02:45 PM.

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"