In a spreadsheet, I have 5 columns of data (numbers or text) that I wish to copy to 5 other columns by using a macro.
There are at least 2 ways to do this:
1. use a loop, changing the column names/numbers by using a variable to identify the columns.
Then carry out the copy/paste functions each time through the loop.
i.e. one set of statements looped thru 5 times. OR
2. simply repeat statements which identify the columns explicitly, followed by the copy/paste functions.
i.e. 5 sets of explicit statements with no loops.
Method 2 is certainly easier to set up, since the variable in method 1 doesn't have to be programmed.
Which is the more efficient code? Or is there any even better way?
Thanks.
There are at least 2 ways to do this:
1. use a loop, changing the column names/numbers by using a variable to identify the columns.
Then carry out the copy/paste functions each time through the loop.
i.e. one set of statements looped thru 5 times. OR
2. simply repeat statements which identify the columns explicitly, followed by the copy/paste functions.
i.e. 5 sets of explicit statements with no loops.
Method 2 is certainly easier to set up, since the variable in method 1 doesn't have to be programmed.
Which is the more efficient code? Or is there any even better way?
Thanks.