snowmangoh
New Member
- Joined
- Oct 24, 2006
- Messages
- 8
First of all, let me apologize because I have seen similar posts, but couldn't extract from them what I need... Certainly an intelligence issue on my end.
I am trying to export a tab to a csv. The entire tab is populated via formulas, that are essentially starting at a column where I am indexing only non-blank values. That csv will then be used to import data to a DB. My current VBA that is exporting the tab is:
This works (almost) as expected, however it exports all "blank" rows (there are formulas there of course), and I wind up with a few hundred rows that are just 20 commas. Is there an easy fix in my code so that it doesn't paste those "blank" rows? In case it matters, the macro is triggered with a button on another tab.
I am trying to export a tab to a csv. The entire tab is populated via formulas, that are essentially starting at a column where I am indexing only non-blank values. That csv will then be used to import data to a DB. My current VBA that is exporting the tab is:
VBA Code:
Sub Export_ePIF_NEW_A()
Dim NewFN As String
NewFN = ThisWorkbook.Path & "\" & Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".") - 1) & " - EPIF_CM_TEMPLATE_NEW-A (" & Format(Date, "DD-MMM-YYYY") & ")" & ".csv"
Debug.Print NewFN
Sheets("epif_cm_template_NEW-A").Copy
With ActiveSheet
.UsedRange.Copy
.Cells(1, 1).PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=True, Transpose:=False
.Cells(1, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
Range("A1:A1").Select
Application.CutCopyMode = False
With ActiveWorkbook
.SaveAs NewFN, xlCSV
.Close False
End With
End Sub
This works (almost) as expected, however it exports all "blank" rows (there are formulas there of course), and I wind up with a few hundred rows that are just 20 commas. Is there an easy fix in my code so that it doesn't paste those "blank" rows? In case it matters, the macro is triggered with a button on another tab.