I have a spreadsheet that i would like to have a row copied from sheet 1 if the value in column f is "L" in that same row. then have the entire row pasted into sheet 2. Please help
Sub Copy_rows_in_a_table()
'Copy rows in a table
'Modified 11-29-17 12:55 PM EST
On Error GoTo M
Dim RngToCopy As Range
Range("Table2").Select
ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=5, Criteria1:="L"
Set RngToCopy = Selection.Offset(-1, 0).SpecialCells(xlCellTypeVisible)
Selection.AutoFilter
RngToCopy.Copy Sheets("Sheet2").Range("A1")
Range("Table2").AutoFilter
Exit Sub
M:
MsgBox "No Rows with your criteria found"
End Sub
Perfect, thanks! I changed "Table2" to "Data" because that is the name of the table. I think you got "Sheet2" and the table name confused. Nonetheless, it works now! Thanks for your help. Sorry about the confusion with the table; I didn't know it made a difference, but I do now!
Perfect, thanks! I changed "Table2" to "Data" because that is the name of the table. I think you got "Sheet2" and the table name confused. Nonetheless, it works now! Thanks for your help. Sorry about the confusion with the table; I didn't know it made a difference, but I do now!
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.