Kristian
04-19-2017, 03:42 AM
Hi,
Im quite new to VBA, and have some problems with the loop concept in VBA.
In this case I have a matrix of percentage-numbers, say 20x4 (as in the picture), where the sum of each of the four columns sum to 100%. I want to, in a new worksheet, select a row-range according to the proportion of the percentage-number in a certain range (say 200 rows) and border each of the selected ranges. So the output will be 200x4 with 20 squares that are bordered in each column. (Yes, this is an attempt to create a Marimekko-chart, but I dont what any help to figure out how to make one, im just trying and failing my own way).
Example; if the row in the first column start with 10%, 20% (instead of 9% and 13% in the picture)...., then I want to select a range of 20 rows (from A1), border the range (with a regular outside border), and then go on to the next 40 cells (from cell A21 to A40) and border that range, and so on..., until I have exhausted the first column, and then I want to do exactly the same with the next column, from B1 to B200.
I have tried so many ways for so long, so hopefully someone here can help me. I understand that the explanation was quite bad, so please ask me questions if its unclear.
18960
BTW, forget about the column widths, I have managed to fix that myself.
Kristian
Im quite new to VBA, and have some problems with the loop concept in VBA.
In this case I have a matrix of percentage-numbers, say 20x4 (as in the picture), where the sum of each of the four columns sum to 100%. I want to, in a new worksheet, select a row-range according to the proportion of the percentage-number in a certain range (say 200 rows) and border each of the selected ranges. So the output will be 200x4 with 20 squares that are bordered in each column. (Yes, this is an attempt to create a Marimekko-chart, but I dont what any help to figure out how to make one, im just trying and failing my own way).
Example; if the row in the first column start with 10%, 20% (instead of 9% and 13% in the picture)...., then I want to select a range of 20 rows (from A1), border the range (with a regular outside border), and then go on to the next 40 cells (from cell A21 to A40) and border that range, and so on..., until I have exhausted the first column, and then I want to do exactly the same with the next column, from B1 to B200.
I have tried so many ways for so long, so hopefully someone here can help me. I understand that the explanation was quite bad, so please ask me questions if its unclear.
18960
BTW, forget about the column widths, I have managed to fix that myself.
Kristian