VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > Excel Help
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-30-2012, 07:49 AM   #1
JoanneA

 
Joined: Apr 2012
Posts: 1
Kb Entries: 0
Articles: 0
Filter by value in cell to the left.

Hi,

I am very new to VBA(Day 4 of using it).
Here is what I am trying to do...

Sheet 1 is a table with the first column and first row as text (table headings). The first column is names and first row is from report names. Namereport 1report 2Jane Doe114John Doe52


Sheet 2 is the report1, for example purposes
NameJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJohn DoeJohn DoeJohn DoeJohn DoeJohn Doe

I am trying to have it to so that when you double click on cell B2 of sheet1, it will go to sheet2 and autofilter on the value to the left of B2 on sheet1 "Jane Doe"

This is what I have so far but when I double click on B2 it just moves the cursor to the cell to the left instead of filtering on the value of the cell to the left on sheet2.

VBA:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim id As String If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(0, -1).Select Else id = CStr(Selection) Sheet2.Activate Sheet2.Range("A1:A500").AutoFilter Field:=1, Criteria1:=IsEmpty(ActiveCell) = False And ActiveCell.Offset(0, -1).Value.id End If End Sub
VBA tags courtesy of www.thecodenet.com


Any help is very appreciated!!
Thank you!!

Local Time: 06:19 PM
Local Date: 05-21-2013

 
Reply With Quote Top
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 07:19 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express