I have two databases, one with user forms that users can enter information into and a second where the information from the user forms is added to a central database. Each time a row is inserted into a particular sheet on the central database the code will add a new row above it so that the next info entered can be added. I need to copy the formula from one of the cells (G1) into the new row that is being inserted.
The code I have at the moment to insert the new row is:
Dim ExBook As Workbook, ExApp As Application
Set ExApp = New Excel.Application
Set ExBook = ExApp.Workbooks.Open("Location\Datastore.xls")
ExBook.Application.Sheets("Lates").Activate
ExBook.Application.Range("A2").Select
ExBook.Application.Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
But this only copies the format and not the formula.
The code I have at the moment to insert the new row is:
Dim ExBook As Workbook, ExApp As Application
Set ExApp = New Excel.Application
Set ExBook = ExApp.Workbooks.Open("Location\Datastore.xls")
ExBook.Application.Sheets("Lates").Activate
ExBook.Application.Range("A2").Select
ExBook.Application.Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
But this only copies the format and not the formula.