Moving to the next line to populate an excel file from VBA
- by edmon
I have the below code that takes certain fields from my MS Access (A small Hotel Reservation Database)form and populates defined cells in the said Excel file.
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("Y:\123files\File\Hotel Reservation.xls")
objXLApp.Application.Visible = True
objXLBook.ActiveSheet.Range("B2") = Me.GuestFirstName & " " & GuestLastName
objXLBook.ActiveSheet.Range("C2") = Me.PhoneNumber
objXLBook.ActiveSheet.Range("E2") = Me.cboCheckInDate
objXLBook.ActiveSheet.Range("F2") = Me.cboCheckOutDate
objXLBook.ActiveSheet.Range("H2") = Me.RoomType
objXLBook.ActiveSheet.Range("I2") = Me.RoomNumber
End Sub
How can I keep populating a new Guest to the same Excel file just on the next row?