Hi Guys i am new to using Macros i have searched below mentioned codes from Google. Macro Code work perfectly but they dont update the sheet. Macro updating after selecting another sheet and back to main sheet. I have Bar/Column Charts on main sheet which update as per Macro Hid/Unhide rows. I want to share this file with my boss but how can i told him that First Select from Drop list and than select another sheet to update the charts. I want to update macro staying on same sheet. Please help.
![]()
Option Explicit Private Sub Worksheet_Activate() Application.ScreenUpdating = False Application.EnableEvents = False Dim HiddenRow&, RowRange As Range, RowRangeValue& '***************************** '< Set the 1st & last rows to be hidden > Const FirstRow As Long = 102 Const LastRow As Long = 114 '< Set your columns that contain data > Const FirstCol As String = "B" Const LastCol As String = "R" '***************************** ActiveWindow.DisplayZeros = False Application.ScreenUpdating = False For HiddenRow = FirstRow To LastRow '(we're using columns B to R here) Set RowRange = Range(FirstCol & HiddenRow & _ ":" & LastCol & HiddenRow) 'sums the entries in cells in the RowRange RowRangeValue = Application.Sum(RowRange.Value) If RowRangeValue <> 0 Then 'there's something in this row - don't hide Rows(HiddenRow).EntireRow.Hidden = False Else 'there's nothing in this row yet - hide it Rows(HiddenRow).EntireRow.Hidden = True End If Next HiddenRow Application.ScreenUpdating = True Application.EnableEvents = True End Sub











LinkBack URL
About LinkBacks

Register To Reply
Bookmarks