Reputation: 33
I am trying to automate a request form where the inputs from the form will transfer to a separate excel sheet
I have this code but error 91 keeps on showing, what went wrong?
Dim book2 As Workbook
book2 = Workbooks.Open("Z:\Requests\Request Form.xlsm")
emptyrow = book2.Sheets("Logs").Range("A1000").End(xlUp).Row+1
book2.Sheets("Logs").Range("A" & emptyrow).Value = ThisWorkbook.Sheets("Request Form").Range("J9:K9").Value
book2.Sheets("Logs").Range("B" & emptyrow).Value = ThisWorkbook.Sheets("Request Form").Range("J12:K9").Value
book2.Sheets("Logs").Range("C" & emptyrow).Value = ThisWorkbook.Sheets("Request Form").Range("C12").Value
Upvotes: 1
Views: 135
Reputation: 511
book2 is a Workbook Object. Objects need to be Set. Change line 2 to:
Set book2 = Workbooks.Open("Z:\Requests\Request Form.xlsm")
Upvotes: 3