I have a question...I am attempting to write the values of multiple textboxes to an MS Excel spreadsheet. I would like to be able to write the values to let say a1,b1,c1,d1...ect and then click on a button to write new values to the next row a2,b2,c2,d1...ect...This is what I came up with but it does not do what I need it to do. here is what I am missing.
a.. I would rather write values to a prexisting MS Excell sheet ex "C:/temp/textexcell.xls"
b.. when I click on the next button it would use either the code I have or something to prepare the user to write values to the next row.
Thanks in advance for your help!!!
Public Class Form1
Inherits System.Windows.Forms.Form
Dim alpha As Char
Dim beta As Char
Dim charlie As Char
Dim num As Integer
Dim a As String
Dim b As String
Dim c As String
Dim exsell As New Excel.Application
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
num = 1
alpha = "a"
beta = "b"
Charlie ="c"
a = Convert.ToString(alpha & num)
b = Convert.ToString(beta & num)
c = Convert.ToString(Charlie & num)
Dim exsell As New Excel.Application
exsell.Visible = True
exsell.Workbooks.Add()
exsell.Range(a).Select()
exsell.ActiveCell.FormulaR1C1 = TextBox1.Text
exsell.Range(b).Select()
exsell.ActiveCell.FormulaR1C1 = TextBox2.Text
textbox1.text =""
textbox2.text =""
textbox3.text =""
End Sub
'Private Sub btnNextRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' num = num + 1
' alpha = "a"
' beta = "b"
' Charlie ="c"
' a = Convert.ToString(alpha & num)
' b = Convert.ToString(beta & num)
' c = Convert.ToString(charlie & num)
exsell.Range(a).Select()
exsell.ActiveCell.FormulaR1C1 = TextBox1.Text
exsell.Range(b).Select()
exsell.ActiveCell.FormulaR1C1 = TextBox2.Text
' exsell.Range(c).Select()
' exsell.ActiveCell.FormulaR1C1 = TextBox3.Text
'End Sub
--
SHANE CLARK