Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jodon Brown   on Nov 13 In MS Office Category.

  
Question Answered By: Tarron Thompson   on Nov 13

"In the end I expect VBA code to extract the summary  sheet"
does not compute... "extract" it? To where?
Extract:
a: to draw forth <extract data>
b: to pull or take out forcibly
c: to obtain by much effort from someone unwilling

OK... as in "extract data".. isn't that what the Summary sheet  already does?
It's extracting the data from the "Data" sheet.
Or are you really saying you want to "Extract" the summary sheet into a separate
workbook?

I think what you're wanting to do is "format" the Summary sheet.

is there a "fixed" number of rows? or will it change from one day to another?
I'll have to make some assumptions.
Assumption #1: in the Summary sheet,
The the Header row is row 1
Column A is for "Sr", Column B is "Expense Type", Column C is "Amount".
for each row with data, Column A has a value.

Then, if you follow my previous instructions,
In the VBA Module, put:

Option Explicit
Dim RowCnt, RowNum
Sub Hide_Rows()
Rows("1:65500").EntireRow.Hidden = False
RowCnt = Application.WorksheetFunction.CountA(Range("A1:A65500"))
For RowNum = 2 To RowCnt
If ((Cells(RowNum, 3) = 0) _
Or (Cells(RowNum, 3) = "")) Then
Cells(RowNum, 1).Rows.EntireRow.Hidden = True
End If
Next RowNum
End Sub

in the Sheet module for the "Summary" sheet, put:

Private Sub Worksheet_Activate()
Hide_Rows
End Sub

If my initial assumptions are wrong, then this macro will have to be modified.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Auto Hide & Unhide summary sheet thru VBA Or get search suggestion and latest updates.


Tagged: