ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create a Macro that will copy the rows that have a value < 0 (https://www.excelbanter.com/excel-discussion-misc-queries/60953-create-macro-will-copy-rows-have-value-0-a.html)

wil4d

Create a Macro that will copy the rows that have a value < 0
 
How do I Create a Macro that will copy the rows that have a value < 0 and
paste them on anther worksheet

Chip Pearson

Create a Macro that will copy the rows that have a value < 0
 
Try something like the following. Change the lines marked with <<
to the appropriate ranges.

Dim DestRng As Range
Dim Rng As Range

Set DestRng = Worksheets("Sheet2").Range("A1") '<<
For Each Rng In Range("A1:A10") '<<
If Rng.Value < "" Then
Rng.EntireRow.Copy Destination:=DestRng
Set DestRng = DestRng(2, 1)
End If
Next Rng


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"wil4d" wrote in message
...
How do I Create a Macro that will copy the rows that have a
value < 0 and
paste them on anther worksheet





All times are GMT +1. The time now is 08:01 PM.

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