View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default How to delete correct # of rows

How do you know what the correct number to delete is? Are you just
trying to eliminate any duplications?

On Oct 12, 2:40*pm, Krystal Peters
wrote:
Thanks for the looping code. *Any idea on how I can delete the correct number
of rows/records....?



"Carlos Mallen" wrote:
Hi Krystal,


I don't really understand what you want to do, but here is a macro for
looping through a range of cells.


Option Explicit
Public Sub LoopThrough()
Dim i As Long
Dim m As Long
Dim wks As Worksheet
Dim wksName As String


wksName = "Sheet1" 'for example
Set wks = ActiveWorkbook.Worksheets(wksName)


m = 10 'for example
For i = 1 To m
* * Debug.Print wks.Cells(i, 1) 'Print in the immediate window the value of
each cell
Next i


Set wks = Nothing


End Sub
--
Carlos Mallen


"Krystal Peters" wrote:


I want to use a macro to clean up a file and save time. *The Requests Found
field is the maximum # of records that can be deleted. *So I could have 1
record with a max of 1 to delete or 5 of a record with a max of 3 to delete
or 1 record with a max of 7 to delete. * I assume I will need to loop through
the rows - any suggestion would be appreaciated. *Thanks, Krystal


SAMPLE DATA:


ACCT_NO * *Requests Found
289278995 * * * * *1
289278999 * * * * *1
289278999 * * * * *1
289278999 * * * * *1
870587008 * * * * *1
119387014 * * * * *1
158675527 * * 2
654375649 * * 2
569777245 * * 2
752478468 * * 2
752478468 * * 2
396378512 * * 2
396378512 * * 2
396378512 * * 2
396378512 * * 2
399778090 * * 3
399778090 * * 3
399778090 * * 3
208777882 * * 4
208777882 * * 4
208777882 * * 4
208777882 * * 4
987178737 * * 4
987178737 * * 4
117468837 * * 7
117468837 * * 7
117468837 * * 7
117468837 * * 7- Hide quoted text -


- Show quoted text -