Copy data when Condition is met

DaGoose

Board Regular
Joined
Jan 20, 2006
Messages
96
Office Version
  1. 2019
Platform
  1. Windows
I need to copy data from one sheet to another sheet when a mathmatical formula shows a certain number. (ie when stock on hand gets below a certain poiint copy the row over to another sheet so it can be reordered). Probably be more than one row to be copied. But I need all the information in the row copied. Col A= part #, Col B= Description, Col C= Vender etc...Nothing fancy but simple. I know this will be an easy solution for you folks that are VBA Guru's. That leaves me out. Any Ideas, better yet any solutions? Thanks for your help in advance.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
suppose sample data is like this (column D is result of formula ok)
suppose you like to copy rows when on hand falls short of 50 nos.
Excel Workbook
ABCD
1part#descriptionvendoron hand
21aq25
32sw95
43de35
54fr79
Sheet1


now try this macro (result is in sheet2)

Code:
Sub test()
Dim filt As Range
 Worksheets("sheet1").Activate
ActiveSheet.UsedRange.AutoFilter field:=Range("D1").Column, Criteria1:="<50"
Set filt = Range("a1").CurrentRegion.SpecialCells(xlCellTypeVisible)
filt.Copy Worksheets("sheet2").Range("A1")
ActiveSheet.AutoFilterMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,391
Messages
6,171,820
Members
452,426
Latest member
cmachael

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