I have following simple code, which takes values from A column and pastes them to B2, one by one, and runs some code on each of these values, which is not relevant to this question.
Problem is, that the amount of values I have in A column is not fixed, there might be 5, might be 15 or more. I cannot tell macro to simply copy and paste values from 13-to 17.
How can I set this range to be dynamic, so if there are only two values, macro stops after these two?
VBA Code:
Range("A13").Copy Range("B2")
Range("A14").Copy Range("B2")
Range("A15").Copy Range("B2")
Range("A16").Copy Range("B2")
Range("A17").Copy Range("B2")
...
Problem is, that the amount of values I have in A column is not fixed, there might be 5, might be 15 or more. I cannot tell macro to simply copy and paste values from 13-to 17.
How can I set this range to be dynamic, so if there are only two values, macro stops after these two?