ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro or scripting help (https://www.excelbanter.com/excel-programming/439619-macro-scripting-help.html)

dizzl3e

Macro or scripting help
 
I have a spreadsheet that goes to column P. All cells have data except for
Column M. Half of column M contains data and the rest are empty cells. I
need to copy or move all data rows associated with the cells in column M
that contains data. Normally I would be able to do this by just recording
macros, but data is constantly being added.

Hope I explained this correctly. Any advice is greatly appreciated.
Thanks.


Jef Gorbach[_2_]

Macro or scripting help
 
The below suggestion uses autofilter to only show those rows where
column(M) is nonblank, then copy all
of the visible rows to your destination. You didn't specify,so I
showed how to page it on sheet2 starting at cell A1.

sub filtercopy()
Cells.AutoFilter Field:=13, Criteria1:="<"
Cells.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Range("A1")
Application.CutCopyMode = False
Selection.AutoFilter
end sub


Good luck, have fun, and let me know if/how I can be of further
assistance.

dizzl3e

Macro or scripting help
 
thanks!! that did the trick..

"Jef Gorbach" wrote in message
...
The below suggestion uses autofilter to only show those rows where
column(M) is nonblank, then copy all
of the visible rows to your destination. You didn't specify,so I
showed how to page it on sheet2 starting at cell A1.

sub filtercopy()
Cells.AutoFilter Field:=13, Criteria1:="<"
Cells.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Range("A1")
Application.CutCopyMode = False
Selection.AutoFilter
end sub


Good luck, have fun, and let me know if/how I can be of further
assistance.




All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com