Hello,
A "double click" on any of the cells in Column B "Trip" launches a routine which produces the following error at present.
[TABLE="width: 633"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Trip[/TD]
[TD]Order No.[/TD]
[TD]Issue[/TD]
[TD]Detail[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]60A[/TD]
[TD="align: right"]1[/TD]
[TD]Issue 1[/TD]
[TD]blah blah blah[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]2[/TD]
[TD]Issue 2[/TD]
[TD]blah[/TD]
[/TR]
[TR]
[TD="align: right"]21/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]3[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/07/2019[/TD]
[TD]12a[/TD]
[TD="align: right"]4[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/03/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]5[/TD]
[TD]Issue 2[/TD]
[TD]was late[/TD]
[/TR]
[TR]
[TD="align: right"]01/08/2019[/TD]
[TD]39x[/TD]
[TD="align: right"]6[/TD]
[TD]Issue 2[/TD]
[TD]blah blah blah[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]7[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]8[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
</tbody>[/TABLE]
Run-time error '424':
Object required
The routine generating the issue is as follows. The fail is on the first range reference, in blue. The names of the sheets in the workbook are "Data" and "Invoice Template"
Can anyone point out where I am going wrong please?
Much appreciated.
A "double click" on any of the cells in Column B "Trip" launches a routine which produces the following error at present.
[TABLE="width: 633"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Trip[/TD]
[TD]Order No.[/TD]
[TD]Issue[/TD]
[TD]Detail[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]60A[/TD]
[TD="align: right"]1[/TD]
[TD]Issue 1[/TD]
[TD]blah blah blah[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]2[/TD]
[TD]Issue 2[/TD]
[TD]blah[/TD]
[/TR]
[TR]
[TD="align: right"]21/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]3[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/07/2019[/TD]
[TD]12a[/TD]
[TD="align: right"]4[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/03/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]5[/TD]
[TD]Issue 2[/TD]
[TD]was late[/TD]
[/TR]
[TR]
[TD="align: right"]01/08/2019[/TD]
[TD]39x[/TD]
[TD="align: right"]6[/TD]
[TD]Issue 2[/TD]
[TD]blah blah blah[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]7[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2019[/TD]
[TD]39B[/TD]
[TD="align: right"]8[/TD]
[TD]Issue 2[/TD]
[TD]text here[/TD]
[/TR]
</tbody>[/TABLE]
Run-time error '424':
Object required
The routine generating the issue is as follows. The fail is on the first range reference, in blue. The names of the sheets in the workbook are "Data" and "Invoice Template"
Rich (BB code):
Sub CreateInvoice(RowNum As Integer)
Application.ScreenUpdating = False
Dim wb As Workbook
Dim sh As Worksheet
With shInvoiceTemplate
.Range("C2") = shData.Range("A" & RowNum)
.Range("D11") = shData.Range("B" & RowNum)
.Range("D12") = shData.Range("C" & RowNum)
.Range("B15") = shData.Range("D" & RowNum)
.Range("D15") = shData.Range("F" & RowNum)
.Range("D16") = shData.Range("G" & RowNum)
.Range("D18") = shData.Range("E" & RowNum)
End With
FPath = "C:\Users\xxxx\Desktop\Invoice"
Fname = Format(shInvoiceTemplate.Range("D10"), "mmmm yyyy") _
& "_" & shInvoiceTemplate.Range("D12")
shInvoiceTemplate.Copy
ActiveSheet.Name = "InvTemp"
Set wb = ActiveWorkbook
Set sh = ActiveSheet
sh.Name = Fname
wb.SaveAs Filename:=FPath & "" & Fname
wb.Close SaveChanges:=False
ThisWorkbook.Activate
Application.ScreenUpdating = True
End Sub
Can anyone point out where I am going wrong please?
Much appreciated.
Last edited by a moderator: