Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9080

Re: How to hide the reports in the sheet.

$
0
0

Hi Venkata, this macro could help you. I design it for a report like these:

 

 

 

excel.png

 

Macro:

 

 

 

Sub Hide_Report()

 

 

 

Dim Num_Row, Num_Column, Last_Row As Integer

 

 

 

Num_Row = 5

 

Num_Column = 4

 

ActiveSheet.Cells(Num_Row, Num_Column).Select

 

Selection.End(xlDown).Select

 

Last_Row = ActiveCell.Row

 

 

 

ActiveSheet.Cells(Num_Row, Num_Column - 1).Select

 

ActiveCell.FormulaR1C1 = "=EPMReportID(RC[1])"

 

ActiveSheet.Cells(Num_Row, Num_Column - 1).Copy

 

ActiveSheet.Range(Cells(Num_Row, Num_Column - 1), Cells(Last_Row, Num_Column - 1)).Select

 

ActiveSheet.Paste

 

 

 

Report_1 = ActiveSheet.Cells(Num_Row, Num_Column - 1).Value

 

 

 

While Last_Row > Num_Row - 1

 

 

 

    If Cells(Num_Row, Num_Column - 1) = Report_1 Then

 

 

 

        Num_Row = Num_Row + 1

 

  

 

    Else

 

 

 

        ActiveSheet.Cells(Num_Row, Num_Column - 1).Select

 

        Selection.EntireRow.Hidden = True

 

        Num_Row = Num_Row + 1

 

  

 

    End If

 

 

 

Wend

 

 

 

End Sub

 

 

 

 

 

In the macro, you only need to change the two inicial values (Num_Row & Num_Column). These are the inicial row of your report (the first row with data) and the first column (row elements column).

 

 

 

Plese, execute this step by step. I hope it solves your problem!

 

 

 

Albert


Viewing all articles
Browse latest Browse all 9080

Trending Articles