Hi,
. I have solutions for you..... rather detailed and involved!!!
. In the end I think going with your code may be the better option, at least initially. You are correct, in this case, having your sorting method was interesting and useful to keep.
. I will drop off a messy version based on your original now, just in case you “pop-in” to the Thread. It does work, but has extra bits and 'comments which I always need to help see what I happening. I leave the Tidying up to you, if you wish to do so.
. I think it may be interesting for me to take a look and see if I can come up with a new from scratch, so I may give that a go later
.................................................
. A few point that spring to mind..
. 1 ) Typo I think in your last Row , sheet Output4, hardly worth mentioning
. 2 ) The codes do not allow for combinations of the forms
2-5ff
- only valid is of the forms
3
2-4
56-58
4ff
4f
( But I guess you already know that )
. 3 ) The new stuff for me in writing this code was getting at parts of text in a cell that were underlined. As always with VBA almost everything is possible. The subject area is just overwhelming. The Range Object must have all that info in, but again if you examine the Range object for some arbitrary cell ( by , for example, setting a Watch on that Range Object in the Watch Window ) again it is just overwhelming. I Googled through some Excel Forum Threads, ( often the best source of info ), and then just experimented a bit. So the method I use to do that may not be the best. It was based on experiments with code such as this...
. Simply run that code sometime, then examine the lines I have added to yopur code at various places which are variations of this form:
and then I think you will get the Point.
. 4) I do not usually use Functions or Call other Subs. (Just a personal “Messy” preference. ) But I have kept your Subs, but needed to modify them and your code so that Range Object ( Zelle ) rather than the Row, ( Zelle.Row ), was taken as I needed to do the extra check for underlining in the Cell , which required the Range Object of that cell.
. It was probably better for tidiness in this case, as I needed to replace some looping with several lines in order to check for underlining at each character
. 5 ) I have one question concerning one line in your code that i do not understand. Can you explain what this ,line is about please
. 6) The other mods, working with a selection and pasting to another sheet ( I call “Output” for now )were fairly straight forward. I think the mods are obvious, Any Questions, ask, no problem
. 7) You will get strange results if your code used with real life data tries to go beyond 256 Columns in the Output Sheet. I expect that may be because the code originally came from something written in a Pre XL 2007 version. ( There was then a limit was 256 columns I think ) . But that can easily be changed to allow you using the entire columns available from XL 2007
................................
. So anyways, to be going in with
.. As before input ( my spreadsheet screenshot does not show the underlining for partly underlined text, but they are as per your original test data and my screen shot in Post # 3 and your Post #4 Images ) . ( Only the references I have changed to names for fun and to unprotect the innocent ! ). I have highlighted in green the selection I made just before running the program
Using Excel 2007
Row\Col |
A |
B |
C |
D |
E |
1 |
Einstein |
1-3 |
5 |
7f |
|
2 |
Doc.AElstein |
2ff |
6-9 |
|
|
3 |
roderh |
1 |
2 |
6 |
8 |
.....
. After running the program you get this in the sheet I have named “Output”
Using Excel 2007
Row\Col |
A |
B |
C |
D |
1 |
|
|
|
|
2 |
1 |
Einstein |
roderh |
|
3 |
2 |
Einstein |
Doc.AElstein |
roderh |
4 |
3 |
Einstein |
Doc.AElstein |
|
5 |
4 |
Doc.AElstein |
|
|
6 |
5 |
Einstein |
|
|
7 |
6 |
Doc.AElstein |
roderh |
|
8 |
7 |
Einstein |
Doc.AElstein |
|
9 |
8 |
Einstein |
Doc.AElstein |
roderh |
10 |
9 |
Doc.AElstein |
|
|
..............................
. The code I will need to paste in the next Post, as it probably will not fit in One Post...Post it a bit later
Bookmarks