From: Mica on 1 Apr 2010 18:58 I have a macro that inserts the value of the active cell into cell A1 of the same worksheet. Pivot tables on other worksheets are then filtered by that value. Now I need to write some error handling so that if the value of the active cell is not contained in the pivot table, it exits the procedure. Here is the code I have so far. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.ScreenUpdating = False If ActiveCell.Value = "" Then Exit Sub Else 'insert project name (value of column A of active row) into cell A1 Range("A1") = Cells(ActiveCell.Row, "A").Value 'insert staff name (value of column B of active row) into cell A2 Range("A2") = Cells(ActiveCell.Row, "B").Value 'refresh all pivot tables ThisWorkbook.RefreshAll End If Application.ScreenUpdating = True End Sub Any help would be greatly appreciated. - Mica
|
Pages: 1 Prev: Look up range and return value Next: Validation on InputBox() |