Solved Move Row to the bottom of the same worksheet if Yes

September 3, 2017 at 15:27:52
Specs: Windows XP
Can anyone help me write a Macro code that will move a row in excel to the bottom of the same worksheet if "Yes" is entered into colomn "I"?
When I select "Yes" from a drop down list in colomn "I". The rows remaining are to move up so there are no empty rows. Row 1 Has Headings
Colomns A - J are in use holding various info. Its only coloum I that I was to be the trigger.
Any response will be appreciated.

See More: Move Row to the bottom of the same worksheet if Yes

Reply ↓  Report •

#1
September 4, 2017 at 00:47:29
✔ Best Answer
Something like this will work, you will need to change the references to sheet1 with the appropriate sheet on your workbook.

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim EndRow
    Dim rgCut As Excel.Range
    Dim DelRow As Integer
    
    EndRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row + 1

    If Target.Column = 9 Then
        If LCase(Target) = "yes" Then
            DelRow = Target.Row
            Set rgCut = Target.EntireRow
            rgCut.Cut Destination:=Sheet1.Range("A" & EndRow)
            Sheet1.Range("A" & DelRow).EntireRow.Delete
        End If
    End If

End Sub


Reply ↓  Report •
Related Solutions


Ask Question