Problem with VB.Net excel sheet insertion!!! VERY URGENT!!! 500 POINTS!
Posted on 2004-09-15
I found a code on how to generate and insert values into excel file.
This is the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Ex As New Excel.Application
Dim W As New Excel.Worksheet
Dim i As Integer
W = Ex.Workbooks.Add.Worksheets.Add
For i = 1 To 20
W.Cells(i, 1).value = "blah 1"
W.Cells(i, 2).value = "blah 2"
W.Cells(i, 3).value = "blah 3"
W.Cells(i, 4).value = "blah 4"
I want to know how can i insert into the next line automaticly. So that i wont have to specify the "i" in w.cells line.
Like you would do into a file like new line. i want to insert in a new line and insert data into the first 4 colums of the new row.
Thanks a lot.