Quantcast
Viewing all articles
Browse latest Browse all 50125

Move specific cells to New Sheet based on Value

Hi Guys,

I have Sheet 2 which will have information

I would like to create a program that will do the following when button is clicked:

1. Find cells with value = "Pend" in "Sheet2" Columns: "B", "D" & "F"
2. Copy cells from "Sheet2" Columns: ("A" + "B"), o ("A"+"D") or ("A"+"F") if "Pend"
3. Create new sheet "Pending Accounts" Paste starting from Row 2
4. Change Cells in "Pending Accounts" from "Pend" to
"Debts" if from (Sheet2, Column "F")
"Bank" if from (Sheet2, Column "B")
"Loan" if from (Sheet2, Column "D")

I have attached an excel with how I want things to look like.
I have used the code in this thread: http://www.excelforum.com/excel-prog...ell-value.html

to copy paste to new sheet but I couldn't work out the other stuff I wanted done.

Here's the code I used to copy paste:
Code:

Option Explicit

Sub copy_dbo()
Dim i As Long, lrow As Long

Application.ScreenUpdating = False

With Worksheets("Sheet1")
    lrow = .Range("A" & .Rows.Count).End(xlUp).Row
    For i = 2 To lrow
        If .Range("B" & i).Value = "dbo" Then .Rows(i).Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    Next i
End With

MsgBox "Done"

Application.ScreenUpdating = True

End Sub

Attached Files

Viewing all articles
Browse latest Browse all 50125

Trending Articles