Forum Discussion

PostHill's avatar
PostHill
Copper Contributor
Apr 24, 2021

VBA Copying data in a cell to another

I am newer at creating VBa scripts. Need some help. I am working on creating a VBA script to copy data from a cell to another cell. Below is a sample data:

LIN**BP*6ZS52WA6AA~

SN1**2*EA*6~

So in this example the data that is in between the BP* ~ will be pasted in a separate cell. So the end result in the empty cell would be
6ZS52WA6AA
Similar to the data in between SN1** * * ~
The end result would be one cell would have 2 the next cell EA and the last cell 6.

14 Replies

    • PostHill's avatar
      PostHill
      Copper Contributor

      The reason is because I do not want to include the BP in a separate cell.  I am looking to put the data

      that comes after the BP* and before the end of the ~ in a cell of its own.  So the example would be that the script would locate the data between the BP* and the ~ then put it in a blank cell on the sheet.  Looking to accomplish the same with the line SN1**2*EA*6~.  So in that example anything in between the SN1** and * would go into another cell so this example it would be the 2.  Then have the EA go into another blank cell and then the 6 would go into a final cell. 

       

       

      • PostHill 

        What is the "rule" behind this? How can we know that you do not want to return BP but you do want to return 2? Both are between ** and *.

Resources