Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA EXCEL and Visible Range

Status
Not open for further replies.

RicksAtWork

Programmer
Nov 1, 2005
120
GB
I have defined a range called Data_individuals

The data has been filtered so that only part of the range is displayed

I have a function that takes a range object.

I want to pass this function the filtered range.

if I just pass range("Data_individuals") this ignores the filtering.

How do I avoid this???
 
Use the the .SpecialCells method using the xlCellTypeVisible constant to get a new range which can be passed.

Dim rg as range
Dim rg2 as range

set rg=range("Data_individuals")

rg.AutoFilter(Field, Criteria1, Operator, Criteria2, VisibleDropDown)

set rg2=rg.SpecialCells(xlCellTypevisible)

You can pass rg2 to routine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top