Hi
I’m using Excel to generate images in Coreldraw using vba and am trying to find a way of generating colour gradient data in excel. I have a spreadsheet with tens of thousands of rows and want to assign an RGB colour to each row. I am struggling with which Excel commands should be used.
To try and explain Im using an example of a Grey image where in each row Im trying to generate a single integer between 0 and 255 but I hope to be able to use what I learn to create 3 columns representing RGB.
Imagine a spreadsheet with 2 columns: In Column A, I want to enter values between 0 and 255 in the top and bottom rows and also enter values (also between 0-255) in any number of arbitrary rows between them – in this example imagine I have entered the following four values –
10 in A1 (top row)
150 in A100,
75 in A900 and
20 in A1000 (bottom row).
I would like Excel to fill the values in Column B so that they step up in value between B1 where it shows 10 to B100 where it shows 150 (here increasing in value in about every other row) and then decreasing in value from B100 to B900 where it shows 75 (decreasing about every 10 rows), and then decreasing from 75 to 20 between B900 to B1000 (here decreasing in value in about every other row).
I think the logic would go something like;
If this row has a value in Column A, use that value in Column B, otherwise
Using the value and row number of the first row ABOVE which has a value and the value and row number of the first row BELOW which has a value, to calc the value for column B
Take the Value of ABOVE from the value of BELOW and divide by the number of rows between them, multiply that result by the number of rows between the this current row and the row ABOVE and then add the value in ABOVE.
I have a limited grasp of Excel and would appreciate help in understanding how to find the non-empty cells and row numbers or any advice if Im going about it badly.
Best wishes
nicksoph
I’m using Excel to generate images in Coreldraw using vba and am trying to find a way of generating colour gradient data in excel. I have a spreadsheet with tens of thousands of rows and want to assign an RGB colour to each row. I am struggling with which Excel commands should be used.
To try and explain Im using an example of a Grey image where in each row Im trying to generate a single integer between 0 and 255 but I hope to be able to use what I learn to create 3 columns representing RGB.
Imagine a spreadsheet with 2 columns: In Column A, I want to enter values between 0 and 255 in the top and bottom rows and also enter values (also between 0-255) in any number of arbitrary rows between them – in this example imagine I have entered the following four values –
10 in A1 (top row)
150 in A100,
75 in A900 and
20 in A1000 (bottom row).
I would like Excel to fill the values in Column B so that they step up in value between B1 where it shows 10 to B100 where it shows 150 (here increasing in value in about every other row) and then decreasing in value from B100 to B900 where it shows 75 (decreasing about every 10 rows), and then decreasing from 75 to 20 between B900 to B1000 (here decreasing in value in about every other row).
I think the logic would go something like;
If this row has a value in Column A, use that value in Column B, otherwise
Using the value and row number of the first row ABOVE which has a value and the value and row number of the first row BELOW which has a value, to calc the value for column B
Take the Value of ABOVE from the value of BELOW and divide by the number of rows between them, multiply that result by the number of rows between the this current row and the row ABOVE and then add the value in ABOVE.
I have a limited grasp of Excel and would appreciate help in understanding how to find the non-empty cells and row numbers or any advice if Im going about it badly.
Best wishes
nicksoph