The following will create a CSV file for use in another application
with your data (instrument readings?). During the run, if you have
old file in your temp directory with current sheetname you will be
asked if you want to replace it (Yes), at the end your file is brought up
in Notepad for your review.
Sub Macro20()
Dim filename As String, RC As Long
filename = "c:\temp\" & _
Replace(Application.ActiveSheet.Name, " ", "") & ".csv"
ActiveSheet.Copy 'creates a new workbook with one sheet
Cells.Select 'select ALL cells
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select 'reduce to only once cell selected
ActiveWorkbook.SaveAs filename:=filename, _
FileFormat:=xlCSV, CreateBackup:=False
'-- activeworkbook is the newly copied worksheet's workbook (.CSV)
ActiveWorkbook.Close savechanges:=False
RC = Shell("Notepad " & filename, 1) 'for your viewing pleasure
End Sub
The central part of the macro is based on recording a macro
Edit, Move or Copy, to book: (new book), and must place a check next to create a copy
Select ALL cells (Ctrl+A before Excel 2003, the gray button in any version)
Ctrl+G, Special, Blanks
Edit, Delete, Shift Left
For your information: Posting with your actual name would be appreciated
as would posting directly to the newsgroups rather than through spammy
websites involving vbulletin, and jelsoft software, designed to spam Google web
searches with material intended for newsgroups.
http://www.mvps.org/dmcritchie/excel/posting.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
"broncoted" <broncoted. ...... wrote
I want to create a macro that reads the numbers in the highlighted [selected]
selection, while ignoring the empty cells so that when they copy it to
something else the output would be