+ Reply to Thread
Results 1 to 3 of 3

Deleting Entire Rows

  1. #1
    Registered User
    Join Date
    05-16-2005
    Posts
    13

    Deleting Entire Rows

    GDay Guys,

    I need a favour :-(

    1 - I need a macro to delete entire rows if in column N, cells contain the following "Allocated for Picking"

    2- I also need a macro that will move an entire row to the bottom of the worksheet (sort) if column D or I cells contain either a zero or negative number in it.

    Some body has already written a macro in the attached file for something similar ie moving the entire row to the bottom if column N cells contain anything other than "Available".however I dont really know what to do to change it.

    Cheers and thanks
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    1 - I need a macro to delete entire rows if in column N, cells contain the following "Allocated for Picking"
    Private Sub CommandButton1_Click()

    Set rng = Range("N:N")
    srch = "Allocated for Picking"

    For Each Cl In rng
    If Cl.Value = srch Then
    Cl.EntireRow.Delete
    End If
    Next

    End Sub

    - Mangesh

  3. #3
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    2- I also need a macro that will move an entire row to the bottom of the worksheet (sort) if column D or I cells contain either a zero or negative number in it.

    Some body has already written a macro in the attached file for something similar ie moving the entire row to the bottom if column N cells contain anything other than "Available".however I dont really know what to do to change it.
    I guess you could make the following change to Leith's code for your current requirement:

    With ActiveSheet
    For I = StartRow To R - 1
    ColD = .Cells(I, "J").Value
    ColI = .Cells(I, "K").Value
    If ColD <= 0 Or ColI <= 0 Then
    With .Range(Cells(I, 1), Cells(I, C))
    .Select
    .Copy (ActiveSheet.Range(FreeRow))
    .Delete (xlShiftUp)
    End With
    End If
    Next I
    End With


    Note: The "Available" code was modified

    - Mangesh

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