Selecting Range After AutoFilter

  • Thread starter Thread starter Randal W. Hozeski
  • Start date Start date
R

Randal W. Hozeski

I have code that runs an AutoFilter, on a six column
dataset in column A thru F. I use the following code
to try select a part of the result.

With .AutoFilter.Range
.Offset(0, 1).Resize(.Rows.Count - 0). _
SpecialCells(xlVisible).Select
End With

This will start the select in Column B but then runs it
out thru column G (a blank)

Question: Is there a way to just select column B,C, & D?
Thanks. -Randy-

..
 
Try:
With .AutoFilter.Range
.Offset(0, 1).Resize(.Rows.Count ,3).SpecialCells(xlVisible).Select
End With

or

Range("B:D").Select

This will select only the visible cells when in the filter mode.
 
Perhaps just another way...

Sub Demo()
With ActiveSheet.AutoFilter
Intersect(.Range, .Range.Offset(1, 0),
[B:D]).SpecialCells(xlVisible).Select
End With
End Sub
 
Thanks I will try it.

How about taking it one step further?

Naming that range? I want to use the
name "test" that was defined earlier,
but after deleting it and redefining it,
the recorder put those referrs to: actual
locations in there. or even better define
ranges within. First 13 entires(rows) = test1
next 13 test2, etc with the last one being
a partial list.

-Randy-
 
Back
Top