lon0316
lon0316

Reputation: 31

How to copy cell if condition is met and paste in another cell?

I'm completely stuck and needs someone to offer up some fresh code because I'm not even close to figuring this out. There are two things I need to do.

  1. If M2>0 then copy M2 and paste it into D2. Continue doing this until every cell in "M" has been evaluated based on row count.
  2. Next, if I end up copying and pasting based on meeting condition then I want to also change Item Status in column F to say "FALSE". Hope someone can help I'm at the tail end of a large project being completed.

Upvotes: 1

Views: 85547

Answers (1)

Lance Roberts
Lance Roberts

Reputation: 22842

For #1, In D2 put

=IF(M2>0,M2,"")

Then click and drag down the entire column

Then in F2 put

=IF(M2>0,"FALSE","TRUE")

Then click and drag down the entire column (assuming "TRUE" is what else is suppose to be in there.

In VBA, here's one way:

For i = 2 to ActiveSheet.UsedRange.Rows.Count
  If Range("M"&i).Value > 0 Then
    Range("D"&i).Value = Range("M"&i).Value
    Range("F"&i).Value = "FALSE"
Next i

Upvotes: 3

Related Questions