Move Row to different work sheet if condition is met

Zab Trader

New Member
Joined
Feb 19, 2019
Messages
5
Have Column P that contains amounts from .01 to 20000 but also can contain blanks, 0, $-, # N/A, possibly others
If a cell in Column P has a value of .01 higher, I would like nothing to happen and then review the next cell in P.
If it doesn't contain a value of .01 or higher, I would like to move that entire row to the spreadsheet called Not Quoted.
Original Sheet is called Quoted and the goal would be to have all cells in Column P to have a value of .01 or higher when finished on the Quoted sheet.
Would like to have this continue until it hits the last row.
Appreciate the help and Thanks!
Zab
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
If you don't mind starting on the "Not Quoted" sheet instead of "Quoted"

Code:
Sub FilterandCopy()


Dim sht As Worksheet
Dim LastRow As Long


Set sht = Sheets("Not Quoted")


LastRow = sht.Cells(sht.Rows.Count, "P").End(xlUp).Row


With sht
   .Range("A1:P" & LastRow).AutoFilter Field:=16, Criteria1:=">0.000001"
   .Range("A1:P" & LastRow).SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Quoted").Range("A1")
   .Range("A2:P" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
   .AutoFilterMode = False
End With




End Sub
 
Upvote 0
Interesting, didn't think of this approach to my issue. Its easier to move cells containing values of .01 or higher than to move all the other noise.
Makes perfect sense, I'll remember that when working on VBA projects.

Doing this worked with only minor issue. How can I adjust you code so that it includes the formula's as well as the data?

I ask for a couple of my columns are interactive. For example they would contain =IF(TRIM(C5) = TRIM(D5), "YES", "NO").
With this copy method Yes or No comes through but isn't interactive for I'm losing the formula.

Thanks, Started using VBA this week and enjoy the heck out of learning as well as coming up with solutions.
Appreciate your help!
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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