Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Const SaveTheseCells As String = "M4:O4;M6:O6;M8:O8;M10:O10;M12:O12"
Sub SaveToFile() Dim MySheet As Worksheet For Each MySheet In ActiveWorkbook.Worksheets Select Case MySheet.CodeName Case "SpecialSheet": Dim SheetToFile As Worksheet Set SheetToFile = MySheet End Select Next MySheet Set MySheet = Nothing Dim FileName As String FileName = "C:\test.txt" FileNum = FreeFile Open FileName For Output As #FileNum Print #FileNum, "start" SheetToFile.Range(SaveTheseCells).Select Dim cell As Range 'This does not save the values of M4, N4, O4, etc. 'What is wrong with this? For Each cell in Selection.Cells Print #FileNum, cell.Text Next cell Print #FileNum, "end" Close #FileNum Set SheetToFile = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SAVE & SEND A FILE BASED ON TEXT IN A CELL VIA MACRO | New Users to Excel | |||
Save file as text from cell | Excel Discussion (Misc queries) | |||
save into file while user is entering values in cell | Excel Programming | |||
Save excel file with filename = cell text | Excel Programming | |||
Save As - Multiple Sheets fails to save as text file | Excel Programming |