+ Reply to Thread
Results 1 to 5 of 5

Thread: Select mutiple entries and copy matching cells onto Invoice sheet

  1. #1
    Registered User
    Join Date
    10-05-2010
    Location
    North Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Select mutiple entries and copy matching cells onto Invoice sheet

    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.
    Attached Files Attached Files
    Last edited by Yorksboy; 10-26-2010 at 08:44 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-29-2009
    Location
    Kalgoorlie Australia
    MS-Off Ver
    Excel 2003
    Posts
    206

    Re: Select mutiple entries and copy matching cells onto Invoice sheet

    Hello Yorksboy
    Were did you want the search number to go?
    Can you give an example please
    Regards
    Peter

  3. #3
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,590

    Re: Select mutiple entries and copy matching cells onto Invoice sheet

    This basic code might give you a starting point
    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
    Assign this to your button.

    Click on the invoice number you want to print on the Inputbox prompt

    Hope this helps
    Attached Files Attached Files
    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.

  4. #4
    Registered User
    Join Date
    10-05-2010
    Location
    North Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Select mutiple entries and copy matching cells onto Invoice sheet

    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.

  5. #5
    Registered User
    Join Date
    10-05-2010
    Location
    North Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Select mutiple entries and copy matching cells onto Invoice sheet

    Thanks Marcol,

    That's certainly got me started.

    regards,

    Mark

    P.S. Just had a thought, this will work OK as long as as I don't have too many tickets for one order ref!

    Quote Originally Posted by Marcol View Post
    This basic code might give you a starting point
    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
    Assign this to your button.

    Click on the invoice number you want to print on the Inputbox prompt

    Hope this helps
    Last edited by Yorksboy; 10-26-2010 at 08:45 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0