Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default hide columns when saving csvq

In Excel 2007, is there a way to save a file to a csv file without certain
columns.

I tried hiding columns D and E, which it does, but when I saved as a .CSV
file - it saves the columns I hid as well.

Thanks,

Tom


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 527
Default hide columns when saving csvq

Don't know about 2007 but this works in 2003. I'm sure the experts can make
or more simple version of this code.

Sub CopyVisCells()
Dim ThisDate As Date, myDate As String, myfile As String
'you might like to change this to
'myfile = activesheet.name 'remove the comma at beginning of line and
' rem or delete next line
myfile = "ShortRept"
ThisDate = Int(Now)
myDate = Day(ThisDate) & "-" & Month(ThisDate) & "-" & Year(ThisDate)

myfile = myfile & " " & myDate
MsgBox myfile
Application.DisplayAlerts = False
Range("A1").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Peter\My Documents\" & myfile,
FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWorkbook.Close
Selection.CurrentRegion.Select
Selection.EntireColumn.Hidden = False
Cells(1, 1).Select
Application.DisplayAlerts = True
End Sub

"tshad" wrote:

In Excel 2007, is there a way to save a file to a csv file without certain
columns.

I tried hiding columns D and E, which it does, but when I saved as a .CSV
file - it saves the columns I hid as well.

Thanks,

Tom



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HIDE COLUMNS HIDE COLUMNS Excel Discussion (Misc queries) 3 July 5th 07 05:56 AM
Hide/Unhide columns using button on top over relevant columns [email protected] Excel Discussion (Misc queries) 1 March 7th 07 09:24 PM
Hide some columns? Ken New Users to Excel 1 October 26th 06 03:25 AM
Saving Into Columns ? Robert11 New Users to Excel 2 September 27th 06 10:52 PM
Cannot Hide Columns Joe A Excel Discussion (Misc queries) 2 December 15th 04 10:22 PM


All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"