I would like to have a loop to find the last used cell in row and insert at the next row.
The range is from C10 to C49.
After last row is inserted, it will prompt a msg open a new excel file.
The problem is i am unable to do the loop part.So, any help or advice would be greatly appreciated.
Thanks and sorry for the silly question.
Private Sub cmdUpdate_Click() Dim objConn As New ADODB.Connection Dim szConnect As String Dim szSQL As String Dim WS As Worksheet szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Excel\Format.xls;" & _ "Extended Properties='Excel 8.0;HDR=NO';" objConn.Open szConnect 'objConn.Execute "UPDATE[Sheet1$C15:D15] SET F1=11235;" Dim xrow As Integer Dim lastRow As Integer lastRow = 10 Do objConn.Execute "UPDATE [Sheet1$C" & lastRow & ":D/>" & lastRow & "]SET F1 =" & txt1.Text & ";" lastRow = lastRow + 1 Loop Until lastRow End Sub