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!

I have the following code which is 1

Status
Not open for further replies.

BatFace

Technical User
Oct 17, 2001
24
AU
I have the following code which is used to filter data according to 2 parameters entered by users in a userform...my problem comes when a usecode is entered that doesn't exist - users won't previously know which use codes are in the current month data. Because the usecode is not in this data the whole of the page is then copied into the other sheet - is there a way to stop this from happening?

Columns("a:eek:").Select
Selection.AUTOFILTER Field:=3, Criteria1:=Use_Code.Text
Range(Cells(2, 1), Cells(lRow, 26)).Interior.ColorIndex = xlNone
Selection.AUTOFILTER Field:=10, Criteria1:=Age2.Text
Range(Cells(2, 1), Cells(lRow, 26)).Interior.ColorIndex = xlNone
Range(Cells(2, 1), Cells(lRow, 26)).Copy

thanks again for you help

[bat]
 
Use a dropdown box to choose your codes from - that way they have to enter values that are there. Can either use code to pick up unique items and add to the dropdown list or pivot table your use_code field and base the dd list off the pivot table
HTH
Geoff
 
Thanks Geoff if I wasn't a newbie to vba I'd be [blush] - at least I can hide behind that excuse! Why didn't I think of that? [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top