Hai ,

I want to select the last row in the excel sheet for enetering the next data.
kindly help me


Code:
Private Sub sadet_Click()
Dim AppXls As Excel.Application
Dim mastexl As Excel.Application
Dim ObjWb, maswb As Excel.Workbook
Dim objws1, masws As Excel.Worksheet
Set mastex1 = New Excel.Application
Dim i, a As Integer
Set maswb = mastex1.Workbooks.Open(App.Path & "\master.xlsx")
 Set masws = maswb.Worksheets("sheet1")
 i = 1
While masws.Cells(i, 1) = ""
i = i + 1
Wend
a = i + 1
With masws
 .Cells(a, 1) = a
 End With
 maswb.Close (SaveChanges = True)
 mastex1.Quit

Set AppXls = CreateObject("Excel.Application")
Set ObjWb = AppXls.Workbooks.Add
Dim ass As String

ass = "" & a + 1 & ""

 Set objws1 = ObjWb.Worksheets.Add
    objws1.Name = "Registration details"
    objws1.Cells(1, 1) = "hello"
    Set objws1 = Nothing
    ObjWb.SaveAs (App.Path & "\" & ass & "")
  ObjWb.Close (SaveChanges = True)
  AppXls.Quit

End Sub
i am getting always 3rd row in the sheet and also nothing is getting updated there

regards

praveen