Visual Basic for Applications (VBA)


AutoFilter Reference criteria


I have looked at similiar possible solutions with no results. Can someone assist me?The code that I'm using works up to the criteria section, I need the code "Criteria1" to reference from another worksheet "Sheet1".On Error Resume Next    With Sheet1         .AutoFilterMode = False         .Range ("A1:B1"0.AutoFilter         .Range ("A1").AutoFilter Field:=1, Criterial:="XXX"    End WithOn Error Goto 0The only problem is "XXX" I wish for this data to selected from another worksheet.Using cell "Sheet2!C6".
Declare a variable and set it's value to that of cell C6 from sheet 2. Then set your Criteria1 to the variable...
Dim n As String
n = Sheet2.Range("C6").Value
On Error Resume Next
With Sheet1
.AutoFilterMode = False
.Range("A1:B1").AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:=n
End With
On Error GoTo 0"The new phonebooks are here!"

Related Links

VBA6 trouble in WINDOWS 10
VBA dynamic formula reference
Printing Userform
Sorting and selecting cells based off name.
How to tune auto filter option for our need???
VBA Loggin into secure websites
MS Project import of custom field data from Excel resulting in Run-time error 462
How to write a filtered data as a text file using macros???
Block specific site and show custom content?
Need Urgent Help, Plzzzzzz what code add in vba to display a html web link, it should be display in outlook body. not a link should be display as we open in explorer
Activate PowerPoint and add slide Vba
Any way to use an Access application in batch mode (no UI)?
VBA Code for below requirement...
Help with exporting Content From Outlook 2010 Emails To Excel Spreadsheet
writing sql in Excel
how to make column width proper.

Categories

MSDN
Using Forums
Visual Studio Development
Commerce Server
Data Platform Development
Internet Explorer Deve...
SQL Server (Pre-release)
Open Specifications
Archived Forums C-D
Archived Forums Visual...
Archived Forums X-Z
Skype for Business
Maps In Windows
Microsoft R
Forums Issues (not pro...
Visual Studio Setup an...
Visual Studio Code Vis...
Office 365 for Developers
Developing Apps for Sh...
SharePoint Legacy Vers...
SharePoint Legacy Vers...
Workflow Manager 1.0
Cloud Services (Web an...
Azure SQL Database
Azure Multi-Factor Aut...
Azure Mobile Apps
Microsoft Azure Site R...
Azure Marketplace
Azure Cache
Azure Database for Pos...
Azure Database for MySQL
.NET Framework Class L...
Windows Presentation F...
Windows Communication ...
Claims based access pl...
Team Foundation Server...
ADO.NET Entity Framewo...
HealthVault Developer
JScript Native
SyncFx - SyncToy-File ...
Microsoft Robotics - C...
Visual Studio Smart De...
SQL Server Tools
SQL Server Security
SQL Server Documentation
Standard 2009: Embedde...
SQL Server 2012 SQL To...
Windows Live Messenger...
Bing Maps: Map Control...
CRM Deployment
App Linking
WebsitePanel - Develop...
The Samsung Windows De...
Bing Maps REST, SOAP, ...
Office Live Basics, Es...
Windows File Sharing P...
Office Protocols
SQL Server Protocols
Silverlight 4
MVVM / ViewModel Patte...
Silverlight for Window...
Windows Performance To...
Reference Source Serve...
.NET Framework Network...
ADO.NET Entity Framewo...
Announcements about pr...
Expression Community S...
Game Technologies: Gen...
HD DVD Interactivity A...
HealthVault Data Types
Managed Extensibility ...
Microsoft Security Dev...
Microsoft Unified Comm...
Popfly Game Creator
Oracle on Azure
POS for .NET
Silverlight (formerly ...
Small Business Applica...
SQL Server 2014 Databa...
SQL Server 2014 Analys...
SQL Server 2014 Integr...
Team Foundation Server...
Visual C# IDE
Visual Studio UI Autom...
Web Sandbox - General
Windows Live Alerts De...
Windows Live Controls ...
Windows Workflow Found...
Building Windows Store...
Mango Update (Archived)
SQL Server 2016 Preview
Maps In Windows - APIs

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile