Copy a row to a new sheet based on cell

PatrickMoose

New Member
Joined
Aug 26, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
SO here is the question and please understand I am not great with excel but do know how to copy paste and a code lol.

Sheet3 has all my data, i would like any row from sheet3 to copy itself and paste itself on sheet1 if the "W" column says "Late". here are the details

Sheet3 starts from A3 to W3 and goes down to A1400 to W1400

Sheet1 starts A3

I also would like the cells in sheet3 to not be deleted when copied and moved.

Any help would be much appreciated
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Welcome to the MrExcel Message Board!

Try this:

VBA Code:
Sub copyRows()
  With Sheets("Sheet3")
    .Range("A2:W2").AutoFilter 23, "Late", xlFilterValues
    .AutoFilter.Range.Offset(1).EntireRow.Copy Sheets("Sheet1").Range("A3")
    .ShowAllData
  End With
End Sub
 
Upvote 0
Thank you for taking time to send this but unfortunately when I pasted the code in, I went back to sheet3 and put "late" into W2 and although the screen flashed, nothing went to sheet1.
 
Upvote 0
See image, i tried w3 and w4 but still no luck, I am definitely doing something wrong lol.
 

Attachments

  • 12.PNG
    12.PNG
    114.1 KB · Views: 5
Upvote 0
Try this:

VBA Code:
Sub copyRows()
  Dim lr As Long
  With Sheets("Sheet3")
    lr = .UsedRange.Rows(.UsedRange.Rows.Count).Row
    .Range("A2:W" & lr).AutoFilter 23, "Late", xlFilterValues
    .AutoFilter.Range.Offset(1).EntireRow.Copy Sheets("Sheet1").Range("A3")
    .ShowAllData
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,789
Members
449,126
Latest member
Greeshma Ravi

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