For each Col question

L

LAF

I have code where I want to process each unique column in a selectio
only once. It works when the user selects an entire column(s) b
selecting the column header. It also works when the user selects
range by hiliting it, even if mulitiple rows are selected. It doesn'
work when you select cells by using the Ctrl key. For example, if
select B9, C12, E19, and B10, the code processes column B twice instea
of once. Is there a way to only process it once? The following my Fo
statement for looping through the columns:


For Each col In Selection.Column
 
F

Frank Kabel

Hi
try
dim rArea as range
dim col as range

for each rArea in Selection.areas
for each col in rArea.columns
'....
next
next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top