View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Reventlov Reventlov is offline
external usenet poster
 
Posts: 2
Default How to delete the content of Excel cells from VBS script?

Il giorno 21 Jun 2008 05:07:45 GMT, (Claudia d'Amato) ha scritto:

I would like to delete the current content/value of the cells

3,6 .... 3,18

How can I do this within a *.vbs script?


Not (totally) tested:

xl.Range(xl.Cells(3,6), xl.Cells(3,18)).ClearContents


And how to do something similar on the xls dropped on the vbs.


Set objArgs = WScript.Arguments 'Vedo se c'è almeno un argomento passato allo script
If objargs.count=0 Then 'altrimenti mostro come si usa il programma
msg= "Trascinare un file xls sull'icona del programma "
msgbox msg ,,Title
wscript.quit
End If
Filename= objArgs(0)
Set xl=CreateObject("excel.application")
xl.Visible=True
xl.Workbooks.Open Filename

FromRow=3
ToRow=3
FromColumn=6
ToColumn=18
For MyRow= fromRow to ToRow
For myColumn=fromColumn to ToColumn
cells(myRow,MyColumn)=""
next
Next

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--