I just started looking for information to help me. This is what I currently have:
Public Class frmResults 'To open Excel Dim ApExcel As Object Dim ApSheet As Object Dim ApBook As Object Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click 'Creates an object ApExcel = CreateObject("Excel.application") ' So you can see Excel ApExcel.Visible = True 'Adds a new book. ApExcel.Workbooks.Add(C:\Users\Mike\Desktop\PTText.xlsx") Dim i As Integer For i = 1 To 700 + 1 If ApSheet.Range("Ai").value = "" Then ApSheet.Range("Bi").value = FName ApSheet.Range("Ci").value = LName ApSheet.Range("Di").value = date2 ApSheet.Range("Ei").value = Age ApSheet.Range("Fi").value = Pushup ApSheet.Range("Gi").value = Situp ApSheet.Range("Hi").value = BComp ApSheet.Range("Ii").value = Run ApSheet.Range("Ji").value = Score ApSheet.Range("Ki").value = Fail End If Next i End Sub End Class
What I want this to do is to search through a spreadsheet and then add a new line of information when it doesn't fina anything in the "A" column.
Currently I am getting a "COMException was Unhandled" problem on this line of code:
I am hoping that I can get some help figuring out what I can do.
Thanks for your help.