I need to write a macro that for example, would copy the value from column A where the condition of cheese was met, and then pasted this value into the adjacent cell in the next column. Where would you start with this?
Asked
Active
Viewed 8,737 times
1 Answers
2
Without a macro:
In B2 enter:
=IF(A2="CHEESE",A2,"")
and copy down
With a macro:
Sub Cheesey()
For Each r In Intersect(ActiveSheet.UsedRange, Range("A:A"))
If r.Text = "CHEESE" Then
r.Offset(0, 1) = "CHEESE"
End If
Next r
End Sub
Gary's Student
- 94,018
- 8
- 54
- 89
-
Use caution with UsedRange http://stackoverflow.com/questions/11886284/usedrange-count-counting-wrong – ApplePie Jan 13 '15 at 18:03