Find strings "BEGINNING" and "END" and add between them a string "BETWEEN" per every code.
Notice that one code can have more than one chain (chain starts with string "BEGINNING", ends with string "END")
Find strings "BEGINNING" and "END" and add between them a string "BETWEEN" per every code.
Notice that one code can have more than one chain (chain starts with string "BEGINNING", ends with string "END")
Put this formula in D1:
=A1
and this one in D2:
=IF(OR(ISNUMBER(SEARCH("beginning",A2)),ISNUMBER(SEARCH("end",A2))),A2,IF(COUNTIF(A$1:A1,"*beginning")=COUNTIF(A$1:A1,"*end"),A2,A2&" between"))
Copy the formula from D2 down as far as you need to.
Hope this helps.
Pete
![]()
Please Login or Register to view this content.
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
Thank you AlphaFrog!!!
Can I just put E1 (and E where column A is in code) if I want this to work for column E?
You're welcome and yes.
Maybe:
![]()
Please Login or Register to view this content.
Works too!
Thank you so much
You're welcome. AlphaFrog's better though.
I tested program and noticed that it adds BETWEEN even for codes that don't have BEGINNING and END - if you rename cell A3 to CODE3 you will see it adds BETWEEN even thou CODE3 doesn't have BEGINNING and END
No need to PM me. I get notified, like you, when there is a reply to a thread I'm subscribed to.
Try this...
![]()
Please Login or Register to view this content.
Not sure what you want to happen when that occurs, does this help?
![]()
Please Login or Register to view this content.
It worked again for the sample I submitted and I thank you for that.
Obviously I didn't express my self well enough so that your code can work for every possible case. The problem is when BEGINNING is also interposal.
My English is limited so I put down the case when code can not do the task.
CODE1
CODE1 BEGINNING
CODE2
CODE2 BEGINNING
CODE1
CODE1 END
CODE1
CODE1
CODE1 BEGINNING
CODE1
CODE1
CODE1
CODE1 END
CODE1
CODE1
CODE2
CODE2
CODE2
CODE2
CODE2
CODE2
CODE2
CODE2 END
CODE2
CODE1
CODE1 BEGINNING
CODE1
CODE1
CODE1
CODE1 END
CODE1
CODE1
?? Maybe:
![]()
Please Login or Register to view this content.
Hey John,
thanks again for working on this.
I tried but it did only for CODE1 but not for CODE2 that has BEGINNING at cell A4 and END at cell A23
In addition codes (CODE1, CODE2...) could be something totally different, like EA, ANYTHING...
I think I misinterpreted what you are looking for? Can you provide the expected results for Post #12.
This is the resulting column
CODE1
CODE1 BEGINNING
CODE2
CODE2 BEGINNING
CODE1 BETWEEN
CODE1 END
CODE1
CODE1
CODE1 BEGINNING
CODE1 BETWEEN
CODE1 BETWEEN
CODE1 BETWEEN
CODE1 END
CODE1
CODE1
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 BETWEEN
CODE2 END
CODE2
CODE1
CODE1 BEGINNING
CODE1 BETWEEN
CODE1 BETWEEN
CODE1 BETWEEN
CODE1 END
CODE1
CODE1
![]()
Please Login or Register to view this content.
Last edited by AlphaFrog; 02-16-2017 at 12:18 PM.
Bingo! Totally works!
Sorry for being confusing and thank you a million
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks