I'm trying to find some code which will seach down column A on 'Invoice Data' sheet for a particular reference number (may be multiple occurances) and then copy the corresponding values from columns D, E, F & G on to the invoice template.
In the first instance, the reference number will be selected by the user, but my aim eventually, is to enter a date and for Excel to produce the invoices for all order references on that date.
Any help would be appreciated.
Example attached.
Last edited by Yorksboy; 10-26-2010 at 08:44 AM.
Hello Yorksboy
Were did you want the search number to go?
Can you give an example please
Regards
Peter
This basic code might give you a starting point
Assign this to your button.Option Explicit Sub ListInvoices() Dim strInvoiceNo As String strInvoiceNo = Application.InputBox("Select Invoice to List") Sheets("Invoice").Range("A20:D36").ClearContents Range("$A$1:$G$75").AutoFilter Field:=1, Criteria1:=strInvoiceNo Range("A2:A10").Copy Sheets("Invoice").Range("A20").PasteSpecial xlValues Range("E2:G10").Copy Sheets("Invoice").Range("B20").PasteSpecial xlValues Range("$A$1:$G$75").AutoFilter End Sub
Click on the invoice number you want to print on the Inputbox prompt
Hope this helps
Last edited by Marcol; 10-26-2010 at 07:21 AM.
If you need any more information, please feel free to ask.
However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
Also
If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.
Peter,
The search number is purely used to select which rows needs to go onto the invoice, so you could say that it's a temporary variable.
Last edited by Yorksboy; 10-26-2010 at 08:45 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks