Excel Planet
New Member
- Joined
- Nov 16, 2017
- Messages
- 26
Hi there,
I don't seem to find a solution for this challenge. Below is a dummy data for demonstration purposes only (data highlighted in blue represents cells being selected by a user):
> columns: A D H
Row 8 2 10 5
Row 18 7 44 3
Row 27 9 66
User is selecting multiple contiguous & non-contiguous cells in different columns, order of selection might not be from left to right (A to C in this case). The thing is I would like to construct a loop that would force VBA to loop first through cells in column A, column B and then C, regardless of the order in which cells were selected.
In addition, I would like to count cells in each column individually to carry-out some comparisons with another file.
I have tried below loop, however, it's looping through cells in order of selection. I searched for a method for counting cells of selection per column using "Area collection" but came up short.
Any help would be highly appreciated.
I don't seem to find a solution for this challenge. Below is a dummy data for demonstration purposes only (data highlighted in blue represents cells being selected by a user):
> columns: A D H
Row 8 2 10 5
Row 18 7 44 3
Row 27 9 66
User is selecting multiple contiguous & non-contiguous cells in different columns, order of selection might not be from left to right (A to C in this case). The thing is I would like to construct a loop that would force VBA to loop first through cells in column A, column B and then C, regardless of the order in which cells were selected.
In addition, I would like to count cells in each column individually to carry-out some comparisons with another file.
I have tried below loop, however, it's looping through cells in order of selection. I searched for a method for counting cells of selection per column using "Area collection" but came up short.
Dim rng As Range
for each rng in selection
msgbox rng.address
next
Any help would be highly appreciated.
Last edited: