Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Loop through cells and place specific values onto them

So I want to create a table like this

enter image description here

I want those specific numbers on the cells.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I had an idea of how to do it where I check the value of the cell above the one I’m filling in.

Something like this

if cell_above.value = 2 then
current_cell.value = -2

if cell_above.value = -2 then
current_cell.value = 4

and on and on like that.

This just seems like a lot of work and there is probably an easier way to do this. Can somebody help me think of another way to solve this? Thank you

>Solution :

if I understood you correctly, you can put those constant values in array and put them into range. Something similar as in this answer: stackoverflow.com/a/33161421/14849657

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading