VBA If value exists in column R get data from subsequent columns and rows

jacob1234

New Member
Joined
Aug 16, 2016
Messages
37
Hi All,

I'm having some difficulty building some reports,

I have a main database where users are submitting information from a userform to the next empty row on a sheet, what I'd like to do is if a user clicks the button that it finds all values with "Pending" in Column R and get all other columns to the right (R to X) and put those on another sheet?

I'd like this macro to find all rows that have the word "Pending" in R - could someone please assist,

Thanks!!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hello Jacob,

Try the following code in a standard module and assigned to a button:-


Code:
Sub TransferJacobsData()

Application.ScreenUpdating = False

With Sheet1.Range("R1", Sheet1.Range("R" & Sheet1.Rows.Count).End(xlUp))
       .AutoFilter 1, "Pending"
       Range("R2", Range("X" & Rows.Count).End(xlUp)).Copy
       Sheet2.Range("A" & Rows.Count).End(3)(2).PasteSpecial xlValues
       .AutoFilter
End With

Application.CutCopyMode = False
Application.ScreenUpdating = True

End Sub

Test it in a copy of your workbook first.
If you need the "used" data cleared from the source sheet, let me know.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Try This:
Searches sheet named "Sheet1" Column R for "Pending"
Will copy rows to sheet named "Sheet2"
Code:
Sub Auto_Filter_Me()
Application.ScreenUpdating = False
    Sheets("Sheet1").Activate
    Lastrow = Sheets("Sheet1").Cells(Rows.Count, "R").End(xlUp).Row
    With Worksheets("Sheet1").Range("R1:X" & Lastrow)
        .AutoFilter
        .AutoFilter Field:=1, Criteria1:="Pending"
        .SpecialCells(xlCellTypeVisible).Copy Worksheets("Sheet2").Range("A1")
    End With
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top