FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I have several groups of non-contiguous cells. The first group starts in A2, the next A14, the next A17 and so on. You can see each of these groupings are not the same length. I would like to use VBA to copy each one of these groupings, but how do I loop between each grouping. I have my process for what comes after the copying, I just need to know how to copy each grouping.
Also, can I return in a msgbox the number of groupings? In this case 4
VBA Code:
Sub CopyMe()
Range("A2").CurrentRegion.Copy
End Sub
Also, can I return in a msgbox the number of groupings? In this case 4
Areas.xlsm | ||||
---|---|---|---|---|
A | B | |||
2 | 14 | 90 | ||
3 | 58 | 33 | ||
4 | 36 | 76 | ||
5 | 70 | 50 | ||
6 | 30 | 61 | ||
7 | 43 | 94 | ||
8 | 29 | 84 | ||
9 | 82 | 63 | ||
10 | 89 | 81 | ||
11 | ||||
12 | 14 | 90 | ||
13 | 58 | 33 | ||
14 | 82 | 63 | ||
15 | 89 | 81 | ||
16 | ||||
17 | 14 | 90 | ||
18 | 58 | 33 | ||
19 | 36 | 76 | ||
20 | 70 | 50 | ||
21 | 30 | 61 | ||
22 | 43 | 94 | ||
23 | ||||
24 | 14 | 90 | ||
25 | 58 | 33 | ||
26 | 36 | 76 | ||
27 | 30 | 61 | ||
28 | 43 | 94 | ||
29 | 29 | 84 | ||
30 | 82 | 63 | ||
31 | 89 | 81 | ||
Sheet2 |