View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Exporting Only Filled Rows To Another Workbook

Hi Cuneyt,

Thanks for providing the additional info about the cells having formulas
that return the empty string. We need to replace the line:

If Application.WorksheetFunction.CountA(.Rows(r)) 0 Then

with this one:

If Application.WorksheetFunction.CountIf(.Rows(r), "") = 0 Then

---
You don't need to use paste special because .Copy copies everything. If you
are wanting only values and formats, that's no problem. Replace this line:

.Rows(r).Copy Destination:=wbkTarget.Sheets(sSht).Range("$A$" &
lNextRow)

with this code:

.Rows(r).Copy
With wbkTarget.Sheets(sSht).Range("$A$" & lNextRow)
.PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Application.CutCopyMode = False
End With

I wonder if it might be easier to pre-format the target sheet and just paste
the values. This would ensure consistency and maintain uniform formatting.
---

This procedure already saves the "FedTest.xls" file. Do you want to "save
as" a copy with the name provided by the user? Do you want this to be part of
this procedure? Do you want it save to the same location as "FedTest.xls", or
a user-selected location?

If the user needs to enter a filename AND a folder location, it would be
easier to display the SaveAs dialog, and let it do everything.

Please provide additional information. You can send your file to me c/o he



Don't forget to "zip" it!

Regards,
Garry