Hi there,
I think the first problem is in the line:
The cells on the Sales worksheet contain Integer or Long values for the SaleID numbers, but the SaleNumber textbox on the CreateInvoice form contains a Text value. As a consequence the If statement always returns a value of False, so the value is never copied to the Invoice worksheet.
To overcome this it is necessary to convert the value contained in the SaleNumber textbox to a Long value before testing it.
I've rewritten the "CommandButton1_Click" in the "CreateInvoice" module as follows, and it seems to do what you want. I've also restricted the number of SaleID cells which are tested - only those cells in the UsedRange of the column are now tested instead of every cell in the entire column.
Your project seems an interesting one and I can probably suggest several other changes which would make your code more robust and more easy to maintain. If you're interested, let me know and I'll see what I can do.
In the meantime, I hope the above helps - please let me know how you get on.
Best regards,
Greg M
Bookmarks