Hidden rows still visuale under CSV

G

Gestron

Dear All,

I'm using Office 97, I've 2 macros : a) hide the rows with amount valu
zero and b) automatic save the sheet to local drive with
csv-extension. But, when the sheet is saved I noticed that in the ne
file the hidden rows are still visual. How to avoid these lines ????

Used code (a) Hidden rows :

Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "W").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "W").Value = 0 Then
Rows(RowNdx).Hidden = True
End If
Next RowNdx
End Sub

Used code (b) save to csv :

Sub export_csv()

ActiveSheet.Copy
ActiveWorkbook.SaveAs FileName:="C:\Temp\Upload.csv"
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False

End Sub:confused
 
R

Robert Christie

Hi Gestron
The file Extension .CSV stands for Comma Separated Values.
When you save an Excel .xls file as a .CSV file only the
formula values are saved the formulas are lost, all
formatting like hidden rows and columns is lost, replaced
with all the cell values separated by a Comma.
I believe it's a common way of transfering raw data from
one application to another.
The file size is much smaller as well.
Just save your file as an Excel Workbook with a filename
followed by the .xls extension and any changes you make
will appear next time you open the file..

HTH
Bob C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top