Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default macro save given range to .xlw

One way:

Assume: save from row 2 down, name to come from A1

Public Sub NoHiddenCSV()
Const DELIMITER As String = ","
Dim myRecord As Range
Dim myField As Range
Dim sOut As String

Open Range("A1").Text & ".csv" For Output As #1
For Each myRecord In Range("A2:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
If Not myRecord.EntireRow.Hidden Then
With myRecord
For Each myField In Range(.Cells, _
Cells(.Row, Columns.Count).End(xlToLeft))
If Not myField.EntireColumn.Hidden Then _
sOut = sOut & DELIMITER & myField.Text
Next myField
Print #1, Mid(sOut, 2)
sOut = Empty
End With
End If
Next myRecord
Close #1
End Sub



In article ,
(topas) wrote:

Please help me with a macro which saves the active worksheet to a
.csv file with the filename to choose or with the filename to get from
a specific cell.
the active worksheet contains hidden areas which must not be saved.

Thanks

Juergen Kimmel

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
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
Save a Range on a Workbook as a CSV File Connie Excel Discussion (Misc queries) 2 October 20th 06 03:42 PM
File Save As -Selected Range Sprint54 Excel Discussion (Misc queries) 1 February 8th 06 02:28 AM
VBA to save range as a HTML fife Brian Lahti Excel Programming 1 September 14th 03 06:49 PM


All times are GMT +1. The time now is 10:09 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"