Hello guys. I would like some help, if possible.
I'm automating the row adjusting of some excel reports, depending on the lines of text in each cell in the A column. This is how I did it:
1 - I calculate the number of lines (wraped text) in each cell via formula:
=LEN(A1)-LEN(SUBSTITUTE(A1;CHAR(10);""))+1
I put this formula at B1. This will return me the number of lines in the text of A1.
Then I repeat this through the whole part that involves texts (there's some images below that I do not want to adjust).
2 - I create a macro and assign it to a button, with the following code:
With that I made each cell have a row height of "number of lines" times 16.5.Please Login or Register to view this content.
That worked but the number of cells varies from report to report. How can I improve this? I would like to check the number of lines via code instead of that formula, then I would have more control and could repeat this process until the last cell with text. Any ideas?
I'm new to excel and VBA, sorry! Thank you!
Bookmarks