Question Clearning a EXCEL Spreadsheet

sourcegin

New member
Joined
Sep 28, 2014
Messages
1
Programming Experience
3-5
Hi all ,
i'm needing assistance in Clearing a Office 2010 Excel Spreadsheet from vb.net 2012 , any assistance in this would be awesome. Even a Complete rewrite Would even Be Better :)

thanks All


Imports Microsoft.Office
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel

Module Module1
'----------------------------------------------------------------------------------------------
'//Code by SourceGin ///

Sub clearDaily() 'Clear sheet named daily
Dim xlApp As New Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim range1 As Microsoft.Office.Interop.Excel.Range
'Dim amount As ??
For Each range1 In xlWorkBook.Range("B10:L40")

' With xlWorkSheet
xlWorkBook.Range("B10:L40") 'range in Clear Method
If xlWorkBook.xlWorkSheet.amount.Value <> 0 Then 'If Value in range <> 0 then Clear
xlWorkBook.Worksheet("Daily").Range("B10:L40").Clear() 'range In daily Sheet to Clear out
End If 'End if All ranges Cleared
Next range1 ' Next Row,Col IN range Of daily Sheet

End Sub

End Module
 
Back
Top