View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cuneyt Cuneyt is offline
external usenet poster
 
Posts: 7
Default Exporting Only Filled Rows To Another Workbook (revised)

Hi Guys,

Can one of you pls help me to update below code to export the data to
below path.
Path= C:\FebTest.xls
Sheet=Data


Sub CopyFilledRows()
' Copies the contents of each non-empty row in a range,
' to another location with no empty rows.


Dim RangeToExport As Range, r As Object
Dim lRow As Long, lTargetRow As Long


Set RangeToExport = ActiveSheet.Range("$A$1:$C$6")
lRow = RangeToExport.Rows(1).Row
lTargetRow = 1


With RangeToExport
For Each r In .Rows
If Application.WorksheetFunction.CountA(.Rows(lRow)) 0 Then
.Rows(lRow).Copy Destination:=ActiveSheet.Range("$E$" &
lTargetRow)
lTargetRow = lTargetRow + 1
End If
lRow = lRow + 1
Next
End With
End Sub


Thanks for all support!

Kindest Regards,
Cuneyt KUYUMCU