Consulting

Results 1 to 5 of 5

Thread: If not in database then add to database

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    If not in database then add to database

    First, I would like to thank everyone for all the help I have gotten. It is really coming along and I am learning alot along the way. However, there is more I want to do to this macro. I think if I show a piece of my code, then explain what I want to do, it will make more sense.

    [VBA]Detail.Columns("E:E").Insert Shift:=xlToRight
    Detail.Range("E1").FormulaR1C1 = "Customer"
    Detail.Range("E2:E" & Detail.Cells(Detail.Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
    "=IF(ISNA(VLOOKUP(RC[-1],'[Atalanta Codes.xls]Cust'!C1:C9,2,FALSE)), VLOOKUP(RC[-1],Cust!C[-3]:C[-2],2,FALSE), VLOOKUP(Detail!RC[-1],'[Atalanta Codes.xls]Cust'!C1:C9,2,FALSE))"
    Detail.Range("E1:E" & Detail.Cells(Detail.Rows.Count, 1).End(xlUp).Row).Value = _
    Detail.Range("E1:E" & Detail.Cells(Detail.Rows.Count, 1).End(xlUp).Row).Value[/VBA]

    As you can see in my formula I do a vlookup in Atalanta codes first then I do a vlookup in Cust tab. After that I want it to look at the cust numbers in the cust tab and add it to the atalanta codes if they are not in there (along with there customer names as well.

  2. #2
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Would this not be easier in Access?
    Peace of mind is found in some of the strangest places.

  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    What do you mean?? it would be easier in access?

  4. #4
    Hi

    For those of us who haven't been involved in the previous, can you put a link to the other post if it explains what you are doing, or explain your process. I'm guessing that this file is somehow going to update / overtype any existing atlanta codes.xls workbook?

    Also, can you not just add another formula similar to the above to get existing detail / new detail for the code?


    Tony

  5. #5
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Here is the link to my full code.

    http://www.vbaexpress.com/forum/showthread.php?t=8634

    I don't want to rewrite what I have in Atalanta Codes but it is a spreadsheet I use to keep track of the items we sell, our customers, warehouses, etc. and their codes. Right now I update it manually whenever I get a chance but I would like the macro to add any customers or products that are not already in the Atalanta Codes workbook.

Posting Permissions

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