Results 1 to 6 of 6

Insert Row For Value Not Found

Threaded View

  1. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Row For Value Not Found

    Maybe this:
    Option Explicit
    
    Sub ExampleInsertSort()
    Dim OutPL As Worksheet, cell As Range, FindIt As Range
    Dim NR As Long
    
    Set OutPL = Sheets("Inventory_YARD")
    NR = OutPL.Range("A" & Rows.Count).End(xlUp).Row + 1
    
    For Each cell In Sheets("Working_Yard").Range("A:A").SpecialCells(xlCellTypeConstants)
        Set FindIt = OutPL.Range("A:A").Find(what:=cell.Value)
        If FindIt Is Nothing Then
            MsgBox "Item #" & cell & " Not Found. " & cell & " will be added to Inventory Yard"
            OutPL.Range("A" & NR) = cell
            OutPL.Range("C" & NR) = Cells(cell.Row, "B")
            OutPL.Range("D" & NR) = Cells(cell.Row, "Y")
            OutPL.Range("F" & NR) = Cells(cell.Row, "Z")
            NR = NR + 1
        End If
    Next cell
    
    Sheets("Inventory_Yard").Range("A:CC").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
            OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers
    End Sub
    Last edited by JBeaucaire; 11-14-2009 at 01:09 PM.

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