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 and Autofilter variables in Excel 1

Status
Not open for further replies.

shortnbald

Technical User
May 30, 2006
3
GB
Hi, I want to simplify my VBA, I'm trying to use a crietia as a variable - and this is not working well (suprise!) any ideas advice appreciated, I've included the basic idea

Sub L3AnE()
Dim WBN As Workbook
Dim CTO As String

Workbooks.Open Filename:="blahblah/address/dataAsheet.xls"
Set WBN = ActiveWorkbook
Set CTO = "whateverA"
Aplication.Run "stubbie"

End Sub

stubbie runs the copy paste, adding named rages etc for local calculations of the data from the above to identified sheets with the variable criteria "whateverA" -

Selection.AutoFilter field:=3, Criteria1:=CTO

this is for 140 sheets...with different criteria for each.
Ideas??
 



Please post VBA questions in Forum707.

Do not use SET for variables. It is used for OBJECTS.



Skip,

[glasses]Just got a nuance...
to replace the old subtlety![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top