![]() |
Moving Data
Hello NG,
Does anybody have a macro that will move data from one sheet to another based on a set criteria? For example A 690 B 690 C 715 D 720 E 720 I would run a macro and it would copy entries A and B to a tab named 690, etc. Thanks in advance |
Moving Data
See the second example
http://www.rondebruin.nl/copy5.htm -- Regards Ron de Bruin http://www.rondebruin.nl "SRS" wrote in message ... Hello NG, Does anybody have a macro that will move data from one sheet to another based on a set criteria? For example A 690 B 690 C 715 D 720 E 720 I would run a macro and it would copy entries A and B to a tab named 690, etc. Thanks in advance |
Moving Data
Dim rng as Range
Dim wks as Worksheet Dim cell as Range set rng = Range(Cells(2,1),Cells(2,1).End(xldown)) for each cell in rng On error resume next set wks = Worksheets(format(cell.value,"@")) On Error goto 0 if not wks is nothing then cell.EntireRow.Copy _ destination:=wks.cells(rows.count,1).End(xlup)(2) end if Next Wil split out your data to sheets based on the value in column B This is a start - you can enrich it to do what you need. If you only want to do 690, then put in a if statement Dim rng as Range Dim wks as Worksheet Dim cell as Range set rng = Range(Cells(2,1),Cells(2,1).End(xldown)) for each cell in rng if clng(cell.Value) = 690 then On error resume next set wks = Worksheets(format(cell.value,"@")) On Error goto 0 if not wks is nothing then cell.EntireRow.Copy _ destination:=wks.cells(rows.count,1).End(xlup)(2) end if End if Next Code is untested, but represents a workable approach. -- Regards, Tom Ogilvy "SRS" wrote in message ... Hello NG, Does anybody have a macro that will move data from one sheet to another based on a set criteria? For example A 690 B 690 C 715 D 720 E 720 I would run a macro and it would copy entries A and B to a tab named 690, etc. Thanks in advance |
Moving Data
Thanks
Ron "Ron de Bruin" wrote in message ... See the second example http://www.rondebruin.nl/copy5.htm -- Regards Ron de Bruin http://www.rondebruin.nl "SRS" wrote in message ... Hello NG, Does anybody have a macro that will move data from one sheet to another based on a set criteria? For example A 690 B 690 C 715 D 720 E 720 I would run a macro and it would copy entries A and B to a tab named 690, etc. Thanks in advance |
All times are GMT +1. The time now is 10:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com