vendredi 27 février 2015

How do I insert a number in a specific cell using different methods?

enter image description here


Q1. From above example you can see I have some numbers from row 34 onwards, using VBA I would like to write a method that will take a value from column B34 (which is K15), it will go to K15 cell and replace 0 with whatever is in B36 (which is 0). Next it will look into cell C34 (which is K12) the program will go to K12 and insert whatever is in D36 (which is 80). This is where first episode ends.


In next method the program should perform same step as above, but this time the program will look in B37 (which is E7) go to E7 insert whatever is in B39 (which is 0) then go to C37(which is W1) go to W1 and insert whatever is in D39. This is second episode done. IMPORTANT- the program should first insert values from first episode and then insert values from second episode because based on first episode values might change in second episode.


Q2. Another question I would like to ask is: above shows two episodes, I would be running this 200 times is there any easy way of doing this? rather than writing 200 methods (each method per episode) assuming that the program will look into fixed rows and columns. For example in episode 1 the program looks at B34 & C34 and in episode 2 the program looks at B37&C37 so from this we know there is a gap of 3 rows 37-34=3. So values from every 3 rows down in B and C columns will be used to find the coordinate to insert some values from other cell.


I would like to have two separate answers one for question 1 and another for Q2 so I can get a better understanding of this:


Aucun commentaire:

Enregistrer un commentaire