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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming a range copied to another sheet and using it to display in list

Status
Not open for further replies.

wabtrainer

IS-IT--Management
Feb 4, 2002
66
GB
I have a range of data on one sheet ("Data_Table_With_Heads") which gets copied to a second sheet at Z1.
I then want to take this copied range, name it "Filtered_Data" and display it in a listbox, but it is only displaying the first column.
What am I doing wrong here?

This is the code thats causing the problem, fresh eyes may be needed to see through the trees!!

Range("Data_Table_With_Heads").AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Range("FilterCriteria"), CopyToRange:=.Range("Z1")'Name the newly created filtered table
.Range("Z1").CurrentRegion.Offset(1, 0).Name = "Filtered_Data"
UserForm1.listFind.RowSource = ""
UserForm1.listFind.RowSource = "Filtered_Data"



If you want to be a bear:
Be a Grizzly!
 
From help:
When you copy filtered rows to another location, you can specify which columns to include in the copy. Before filtering, copy the column labels for the columns you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.

So Range("Z1") should be along the lines of Range("Z1:AB1") with that range being the column labels defining the columns you wanted extracted.




Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top