Hi,
i'm currently writing some code in which I simulate the population dynamics of a butterfly and its host plant. I now have two arrays for the within season dynamics of the plant and insect.
within the first array i show plant IDs, their current patch (random between 1 to 5) as well as the current day within a season (each plant and butterfly is iterated through 120 days), flowering day for the plant and the number of eggs laid on the plant.
in the butterfly array i also show butterfly ID, day, emergence day from pupae, the plant the butterfly is currently found in and the patch the host plant is found in.
now, i wrote some code in which i state that if the current day is equal to the day of butterfly emergence, the butterfly lays 26 eggs. those 26 eggs need to be laid on a RANDOM plant (ech butterfly lays one egg per plant) within the patch the butterfly is currently found. The total number of eggs per plant is to be recorded on the plant array. I'm not sure how to do that. Bare in mind i will also need to iterate the array for the number of seasons in question as currently the values show only the behaviour of plants and butterflies in a period of 120 days i.e. one season (which by the way is also something i have a problem with but on that perhaps in a later thread). I would attach my file but not sure why i'm not able to and pasting the code onto the thread seems a little silly considering i have about 450 lines of code so I apologise if this isn's very clear from my explanation.
any suggestions? (very new to VBA)
thanks in advance
Bookmarks