What I want is:
1. If I put CANCELLED on column A, the values on column N,O,P,Q,R becomes "," + their current value.
2. Skip or ignore blank cells in N,O,P,Q,R.
Sub Demo1() Const F = "TRANSPOSE(IF(#=""CANCELLED"",ROW(#)))" For Each V In Filter(Evaluate(Replace(F, "#", ActiveSheet.UsedRange.Columns(1).Address)), False, False) With Cells(V, 14).Resize(, 5) .Value = Evaluate(Replace("IF(#>"""","",""&#,"""")", "#", .Address)) End With Next End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
-bradl822
Thanks for the code. I tested it, works fine if there is only one row used. When i move to A2 and put cancelled, it adds another comma to any cell with cancelled. In short, every time i use the code, all rows with cancelled adds additional comma to their values. Hope someone can improve your code.
-Marc L
For some reason, when I use the code, all the base values from N,O,P,Q,R becomes empty.
Here I will upload the file. I will use the code on the first sheet.
On my side it rocks at a glance, so something weird with your workbook …
Anyway, try this
(and you can try the easy Find method for a faster execution maybe, as you can see within VBA inner help) :
PHP Code:
Sub Demo1a() Const F = "TRANSPOSE(IF(#=""CANCELLED"",ROW(#)))" Application.EnableEvents = False For Each V In Filter(Evaluate(Replace(F, "#", Range("A5", [A4].End(xlDown)).Address)), False, False) With Cells(V, 14).Resize(, 5) .Value = Evaluate(Replace("IF(#="""","""","",""&#)", "#", .Address)) End With Next Application.EnableEvents = True End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know
There are 10 kinds of people in this world... those who understand binary, and those who don't.
- Marc L
Thank you for the code but still it adds another comma to the previous cancelled cells...
- Arkadi
Perfect pal, just what I needed. If you could edit the code to something like, if its not cancelled, then remove the existing commas, I thank you so much. But the code alone is enough for me.. Again Thank You!
Bookmarks