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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.