• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

clear data by vba

srk@1234

New Member
vba is placed in a seperate file
open the 1.csv file and clear all the data in 1.csv file and save it and close that file
this is the process i have to do by vba so plz have a look
 

Marc L

Excel Ninja
Instead of clearing the file just delete it via Kill VBA statement​
or the file is automatically overwritten when a new one is created​
or you can easily do it yourself the way you want just activating the Macro Recorder before operating manually …​
 

vletm

Excel Ninja
srk@1234
Did You noticed that #2 reply has three (3) different variations?
Did You think second variation? It makes same as Your 'have to'.
Did You try to do third variation? It seems to give the most nearest result for Your 'have to'.
 

srk@1234

New Member
but what about the open and save process plz read my post
i recorded macro
cells.select
selection.delete shift: =xlup
end sub

but read my post we have to open and save
 

vletm

Excel Ninja
srk@1234
Why You didn't start to record marco BEFORE that file is open?
Why You didn't save that file AFTER You have ... deleted ... hmm? You have written that CLEAR is the MUST!
 

vletm

Excel Ninja
srk@1234
You should try to record it ...
1) make sure that Your 1.csv-file is closed
2) open a new Excel-file
3) Tools > Marcos > Record New Macro ...
4) Give a name for Macro
5) Open Your named 1.csv-file
6) Select from sheet the left top corner to get all cells selected
7) Use mouse's right button to get menu
8) Select 'Clear Contents'
9) Press Ctrl+S to save it
10) Close that 1.csv-file
11) Stop Marco Recording
 
Top