I have a worksheet with unique numbers in each cell in column A; the number of cells with data could be anywhere from 2 to 999. The data would thus look like this:
I will then need to output those values, in groups of not more than 5, to a row elsewhere, such as:
etc....
Rather than hardcode each possible combination of 5 cells into its own line (as in repeating that line over and over, then manually adjusting the cell addresses for each line...sheesh, that would be tedious), I'm trying to think of how I can accomplish that in the minimal amount of code. I'm sure there is a way to use variables and other if/then or for each/next scenarios to accomplish this, and I will figure it out eventually. But, on the chance that someone might have a ready idea at hand, I would appreciate any insights/direction. I've got a tremendous amount of code I can refer back to, but I just don't recall having done anything quite like this before.
XXXX0000000 |
XXXX1111111 |
XXXX2222222 |
I will then need to output those values, in groups of not more than 5, to a row elsewhere, such as:
VBA Code:
range("D1").Value = A1 & " " & A2 & " " & A3 & " " & A4 & " " & A5
Rather than hardcode each possible combination of 5 cells into its own line (as in repeating that line over and over, then manually adjusting the cell addresses for each line...sheesh, that would be tedious), I'm trying to think of how I can accomplish that in the minimal amount of code. I'm sure there is a way to use variables and other if/then or for each/next scenarios to accomplish this, and I will figure it out eventually. But, on the chance that someone might have a ready idea at hand, I would appreciate any insights/direction. I've got a tremendous amount of code I can refer back to, but I just don't recall having done anything quite like this before.