View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_387_] mudraker[_387_] is offline
external usenet poster
 
Posts: 1
Default Deleting lines that are not needed.


heres one way

Option Explicit

Sub CopyData()
Dim wS1 As Worksheet
Dim ws2 As Worksheet
Dim lRow As Long
Dim l4Row As Long
Dim lNxtRow As Long

Set wS1 = Sheets("sheet1")
Set ws2 = Sheets("sheet2")

lRow = wS1.Cells.Find(what:="*", searchorder:=xlByRows, _
searchdirection:=xlPrevious).Row
lNxtRow = ws2.Cells.Find(what:="*", searchorder:=xlByRows, _
searchdirection:=xlPrevious).Row
For l4Row = 1 To l4Row Step 1
If wS1.Cells(l4Row, "b").Value < "" _
Or wS1.Cells(l4Row, "c").Value < "" Then
lNxtRow = lNxtRow + 1
wS1.Range("a" & l4Row & ":e" & l4Row).Copy ws2.Cells(lNxtRow, "a")
End If
Next l4Row
End Su

--
mudrake
-----------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...nfo&userid=247
View this thread: http://www.excelforum.com/showthread.php?threadid=54062