OK... there's probably HUNDREDS of different approaches and variations
to approaches to do what you're asking.
In order to recommend an approach, I REALLY need to understand
how you WANT it to act.
Here's the clues I'm working with:
You said: "In sheet with name "Summary" there are 3 columns (Sr, Expense Type &
Amount). "
and: "those "Expense Type" which have no amount or zero balance should
automatically hide "
I believe this to mean:
Lines where the VALUE in the "Amount" column is blank or 0 should be hidden.
You said: "(should hide/unhide automatically & without clicking a button)"
I believe this to mean:
Data is changed in the "Data" tab. When the "Summary" sheet is selected,
the data is automatically updated, and the blank or 0 value lines will be
hidden.
=====================================================
Now, if this is an accurate statement of the "problem", then it's relatively
easy to
do.
First though, do you already have the "Summary" sheet working to summarize
the data from the "data" sheet?
If so, then the first hurdle is done and we're ready to move on.
How much VBA do you know? I don't want to go into specific detail and give
you WAY too much information than you need.
Instead, I'll describe the process. Let me know if you need help with the
individual steps.
The next step is to decide how you want the blank rows to be "hidden".
Simply hiding the row would be the easiest. For this approach:
First, record a macro (call it "Hide_Rows") that hides a row, then unhides all
rows.
This will create the coding you'll need to accomplish your task.
Next, rearrange the macro you recorded so that it first unhides all rows.
Then, set up a loop from the first row of the summary (excluding any header)
to the last row of the data (be sure to add a few rows for later "expansion").
In the loop, test the "Amount" value in each row to see if it is = "" or = 0,
if true, then modify the code recorded that hides a row to hide this row.
Test the sub.
Once you've got the sub working, In the VBA editor, double-click on the
"Summary"
sheet and you'll be taken to the code space for that sheet.
At the top left of the sheet panel, use the pull-down to select "Worksheet",
then on the right, use the pull-down to select "Activate".
This will create a Worksheet_Activate "event" subroutine.
In this event sub, enter the name of your new sub (Hide_Rows).
Now, go back to excel and select the "Data" tab, then select the "Summary" tab.
The blank and 0 value rows should now be hidden.
If you need help with any or all of this, don't hesitate to ask!