Results 1 to 20 of 20

Multiple move/delete #N/A with vlookups

Threaded View

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    CA
    MS-Off Ver
    2007
    Posts
    67

    Multiple move/delete #N/A with vlookups

    Sub AAAA()'
    ' AAAA Macro
    '
    
    
    '
    Sheets("Master Supra").Activate
        Columns("B:B").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("B2").Select
        ActiveCell.FormulaR1C1 = "=IF(RC[71]=""Child"",VLOOKUP(RC[-1],'Data Creation'!R1:R1048576,1,FALSE),"""")"
        Range("B2").Select
    lastRow = Range("A" & Rows.Count).End(xlUp).Row
        Range("B2").AutoFill Destination:=Range("B2:B" & lastRow)
         Range("B2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.Run "DELETENA"
    End Sub
    
    
    
    
    
    
    Sub DELETENA()
    'For Move Entire Row to New Worksheet if Cell Contains Specific Text?
    'Using autofilter to Copy rows that contain centain text to a sheet called Errors
    Dim LR As Long
    LR = Sheets("Master Supra").Cells(Rows.Count, "B").End(xlUp).Row
    LR1 = Sheets("Supra Disco").Cells(Rows.Count, "A").End(xlUp).Row + 1
        With Sheets("Master Supra").Range("B2:B" & LR)
            .AutoFilter
            .AutoFilter Field:=1, Criteria1:="#N/A"
            .SpecialCells(xlCellTypeVisible).EntireRow.Copy Destination:=Sheets("Supra Disco").Range("A2" & LR1)
            .SpecialCells(xlCellTypeVisible).EntireRow.Delete
                Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
            Application.Run "ABRAKADABRA"
        End With
    End Sub
    
    
    
    
    
    
    Sub ABRAKADABRA()
    '
    ' ABRAKADABRA Macro
    '
    
    
    '
    Sheets("Data Creation").Activate
        Columns("B:B").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("B2").Select
        ActiveCell.FormulaR1C1 = "=IF(RC[71]=""Child"",VLOOKUP(RC[-1],'Master Supra'!R1:R1048576,1,FALSE),"""")"
        Range("B2").Select
    lastRow = Range("A" & Rows.Count).End(xlUp).Row
        Range("B2").AutoFill Destination:=Range("B2:B" & lastRow)
         Range("B2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.Run "ADDNA"
    End Sub
    
    
    Sub ADDNA()
    'For Move Entire Row to New Worksheet if Cell Contains Specific Text?
    'Using autofilter to Copy rows that contain centain text to a sheet called Errors
    Dim LR As Long
    LR = Sheets("Data Creation").Cells(Rows.Count, "B").End(xlUp).Row
    LR1 = Sheets("Master Supra").Cells(Rows.Count, "A").End(xlUp).Row + 1
        With Sheets("Data Creation").Range("B2:B" & LR)
            .AutoFilter
            .AutoFilter Field:=1, Criteria1:="#N/A"
            .SpecialCells(xlCellTypeVisible).EntireRow.Copy Destination:=Sheets("Master Supra").Range(LR1)
            .SpecialCells(xlCellTypeVisible).EntireRow.Delete
                Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
            Application.Run "ABRAKADABRA"
        End With
    End Sub
    This is the current code i', working with, and it somewhat works for the first maco sub, but i'm at least 80% sure that there is a waaay easier way to accomplish what i'm going for:

    Okay so i spliced together 4 subs which the first 2 work (sometimes), but the last 2 do not?
    My objective is simple, and you can use this as a reference: https://app.box.com/s/28q2ibnryvu60i8sayj0atbiza4m4qym

    So here is the plan:
    1. Vlookup column A in "Master Supra" to lookup sheet "Data Creation"
    2. Anything that comes up #N/A move to "Supra Disco" & Delete from original sheet
    3. Delete vlookup column

    4. Vlookup Column A in "Data Creation" to lookup sheet "Master Supra"
    5. Anything that comes up #N/A copy/paste to "Master Supra" WITH THE APPROPRIATE COLUMNS (highlighted yellow?) (KEEP IN ORIGINAL SHEET)
    6. Delete vlookup column

    *NOTE* i had not attempted moving the data from Data Creation -> Master Supra with the correct columns
    I.E: "Title Generator" goes into "Item_Name", "Price Calc" goes into "Price". I'm not so lost that i can't figure out how to change the destionations of the cells, i just don't know VBA to this extent i've just been splicing VBA from things i find on the web.

    Any and all help would be AMAZING
    Last edited by BlakeSkate; 04-21-2015 at 05:31 PM. Reason: Solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Multiple Vlookups
    By Sasquatch2014 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-11-2014, 05:12 PM
  2. Move/Delete items between multiple list boxes in a UserForm that correspond to tables
    By salvo2002 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2014, 07:43 PM
  3. [SOLVED] Move/Copy worksheets (possibly) using vlookups
    By daniel_t in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2013, 11:56 AM
  4. VLOOKUPS in multiple closed workbooks with multiple tabs
    By exclusivelyexcel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-23-2011, 03:33 PM
  5. delete row if one of multiple values and then move on top
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2009, 01:30 AM

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.6.0 RC 1