CaptainCsaba
Board Regular
- Joined
- Dec 8, 2017
- Messages
- 78
Hi!
So here is the problem. We get a PDF report, and since it is not that well made, when we extract it into excel All the different columns get put into column one together. We only need a few lines from there that I managed to offset (so some cells in column D are empty) and from these lines we get to a point that is beyond my capabilities. We need to divide the cell into two different cells at exactly the right place, but because of the conversion this changes every time. I managed to figure out a way but I don't know how to put it into VBA. here are a few lines:
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: ABN97) 1,353,255 JUPITER ASSET MANAGEMENT
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"][TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 16127) 325,000NFU MUTUAL[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 23860) 372,461JPMFAM[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 13465) 1,546,230 UBS ASSETMANAGEMENT[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: ECE51) 370,915225 FRANKLINST[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA04) 56,593BLACKROCKINVESTMENT [/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA15) 110,22117F 100,TOEGYE-RO
[TABLE="width: 421"]
<tbody>[TR]
[TD="width: 421"](Ref: 85789) 304,64211-3, HAMAMATSUCHO, 2-CHOME,[/TD]
[/TR]
</tbody>[/TABLE]
So here is how the rows work. First there is the ref code (red), then the shares amount (green),
then the manager or the address of the manager (orange).[/TD]
[/TR]
</tbody>[/TABLE]
From this we need the green in a cell and the orange part in a cell. (red is not needed). As you can see, the problem is that because of the bad conversion the end of the green part is not always the same. Sometimes it ends with a space, sometimes it is together and the worst is when there is an address number after it there is no space in between. I am open to all solutions., but what I thought of is this. The end of the ref code is always the same ") ". What the macro should do is it should find this point in the cell (by the way this is column D), and after that it should copy from one up to 3 numbers. If there is a comma "," after the 3rd number it should copy the 3 numbers after that and so on until there is no comma after the 3 number.
So in the end if the base text is in Cell D38 for example is [TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA15) 110,22117F 100,TOEGYE-RO[/TD]
[/TR]
</tbody>[/TABLE]
then it should have 110,221 in Cell M38 and 17F 100,TOEGYE-RO in cell N38.
I hope this is possible. I am open to all solutions because this might not work 100% of the time, so some advice would be much appreciated.
So here is the problem. We get a PDF report, and since it is not that well made, when we extract it into excel All the different columns get put into column one together. We only need a few lines from there that I managed to offset (so some cells in column D are empty) and from these lines we get to a point that is beyond my capabilities. We need to divide the cell into two different cells at exactly the right place, but because of the conversion this changes every time. I managed to figure out a way but I don't know how to put it into VBA. here are a few lines:
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: ABN97) 1,353,255 JUPITER ASSET MANAGEMENT
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"][TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 16127) 325,000NFU MUTUAL[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 23860) 372,461JPMFAM[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: 13465) 1,546,230 UBS ASSETMANAGEMENT[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: ECE51) 370,915225 FRANKLINST[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA04) 56,593BLACKROCKINVESTMENT [/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA15) 110,22117F 100,TOEGYE-RO
[TABLE="width: 421"]
<tbody>[TR]
[TD="width: 421"](Ref: 85789) 304,64211-3, HAMAMATSUCHO, 2-CHOME,[/TD]
[/TR]
</tbody>[/TABLE]
So here is how the rows work. First there is the ref code (red), then the shares amount (green),
then the manager or the address of the manager (orange).[/TD]
[/TR]
</tbody>[/TABLE]
From this we need the green in a cell and the orange part in a cell. (red is not needed). As you can see, the problem is that because of the bad conversion the end of the green part is not always the same. Sometimes it ends with a space, sometimes it is together and the worst is when there is an address number after it there is no space in between. I am open to all solutions., but what I thought of is this. The end of the ref code is always the same ") ". What the macro should do is it should find this point in the cell (by the way this is column D), and after that it should copy from one up to 3 numbers. If there is a comma "," after the 3rd number it should copy the 3 numbers after that and so on until there is no comma after the 3 number.
So in the end if the base text is in Cell D38 for example is [TABLE="width: 417"]
<tbody>[TR]
[TD="width: 417"](Ref: EQA15) 110,22117F 100,TOEGYE-RO[/TD]
[/TR]
</tbody>[/TABLE]
then it should have 110,221 in Cell M38 and 17F 100,TOEGYE-RO in cell N38.
I hope this is possible. I am open to all solutions because this might not work 100% of the time, so some advice would be much appreciated.