![]() |
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. |
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. |
All times are GMT +1. The time now is 01:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com