#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Possible?

Hi,

I dont know a great deal of VBA, so dont know if this is possible...

I have a spreadsheet with 2 sheets, One is a kind of contents page, the
other is a notes field.

Sheet1 - TOC

Task Description
A Blah Blah
B More Blah Blah

Sheet2 - Notes

Task Detail
A This and That
A That and This
B Not that

What I am wanting to do is to be able to click the cell in sheet 1 that
contains a task letter and this set the autofilter to filter on the clicked
cells value.

Is this possible??

Many thanks,


Mark.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Possible?

Hi Mark,

this is not too difficult. I did not fully understand what you really want
to achive. I guess you want to filter the list in sheet "Notes" according to
the selection the user has made in sheet "TOC". Right?

These are the steps:
1. Create a button in sheet "TOC" and call it for example
"btn_ShowNotesForTask".
2. In the appropriate routine you call another procedure which must be
located in a general module (otherwise the code might not work properly).

Private Sub btn_ShowNotesForTask_Click()
Call FilterTaskDetails
End Sub

3. This is how the procedure looks where the actual work is done:

Public Sub FilterTaskDetails()
Dim str_Task As String

'Check whether the correct colum has been selected
'and whether the cell contains a value with lenght 1
'This assumes that the task letters are listed in column A
If ActiveCell.Column < 1 Or ActiveCell = "" Or Len(ActiveCell) 1 Then
Exit Sub
End If

str_Task = ActiveCell.Value
Sheets("Notes").Select

'Check whether the list is filtered already
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
If ActiveSheet.AutoFilterMode Then
Cells.AutoFilter
End If

'Set the fiter
Range("A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=str_Task

End Sub


Best,
Andreas

Hi,

I dont know a great deal of VBA, so dont know if this is possible...

I have a spreadsheet with 2 sheets, One is a kind of contents page, the
other is a notes field.

Sheet1 - TOC

Task Description
A Blah Blah
B More Blah Blah

Sheet2 - Notes

Task Detail
A This and That
A That and This
B Not that

What I am wanting to do is to be able to click the cell in sheet 1 that
contains a task letter and this set the autofilter to filter on the clicked
cells value.

Is this possible??

Many thanks,


Mark.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"