Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using an Excel macro to format a file for import into another program.
The file is ultimately saved as a .csv file. Since a range of cells needs to have the information deleted before it can be imported I have written the following: Selection.Clear. However, when I try to import this file the host program is seeing something there and kicking it back. If I open the .csv file and select the cells in question and press the delete key, save and close, the file imports with no problem. MY QUESTION IS, what code can I use instead of ?Selection.Clear? that will more accurately duplicate what happens when I press the delete key? (When you record a macro and look at the code pressing the delete key results in the command ?Selection.ClearContents? ? this, however, results in the same problem) -- Message posted via http://www.officekb.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
how about
selection.delete (though this will literally delete and shift cells around) try also selection.clearcontents "Mel Wasko via OfficeKB.com" wrote: I am using an Excel macro to format a file for import into another program. The file is ultimately saved as a .csv file. Since a range of cells needs to have the information deleted before it can be imported I have written the following: Selection.Clear. However, when I try to import this file the host program is seeing something there and kicking it back. If I open the .csv file and select the cells in question and press the delete key, save and close, the file imports with no problem. MY QUESTION IS, what code can I use instead of ?Selection.Clear? that will more accurately duplicate what happens when I press the delete key? (When you record a macro and look at the code pressing the delete key results in the command ?Selection.ClearContents? ? this, however, results in the same problem) -- Message posted via http://www.officekb.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ben,
Thank you for your suggestion. I actually did try both of those. Of all things I have found my solution in an unexpected place. I discovered that what made the import work was NOT the fact that I pressed the delete key but simply that I had opened, changed and saved the file again. I have now written that into my macro and everything is working. Not sure why it requires that step but I'm happy it works. Thank you again for you input. Mel -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell Deletion | Excel Discussion (Misc queries) | |||
Conditional deletion of cell contents | Excel Worksheet Functions | |||
Prompt Before Cell Deletion | New Users to Excel | |||
#REF! after cell deletion | Excel Discussion (Misc queries) | |||
Protect contents in a cell from deletion | Excel Programming |