View Single Post
  #8   Report Post  
Harlan Grove
 
Posts: n/a
Default

Cathy Landry wrote...
I did want only r & x, but then realized that if I needed to add/delete a
column in between them I'd have to adjust the code each time. By putting in
the range, it is working much better. Thank you very much to all that have
replied! Cathy

....

The advantage to using an advanced filter is that it uses field names
rather than column addresses. Add or remove as many columns as you want
as long as you keep the columns that were originally R and X. Wherever
they are, they'd retain their column labels/field names.

As for the macro, if you inserted a column to the left of X, then the
column that had been X would no longer be between columns R and X
inclusive. OTOH, if you deleted a column to the left of R, then the
column that had been R would no longer be between columns R and X. Your
rationale for using the code as-is is wrong. It won't help you if you
insert of delete columns.