View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
UB UB is offline
external usenet poster
 
Posts: 120
Default VBA code to hide blank rows

Thanks Bernie & Pete_UK

It works

Regards

"Bernie Deitrick" wrote:

Select your table, then use Data / Filter / Autofilter, then select Non-Blanks from the dropdown at
the top of the column.

In code, that would be, possibly. though you may want more filtering that allowed by this:

Range("B:B").AutoFilter Field:=1, Criteria1:="<"

HTH,
Bernie
MS Excel MVP


"ub" wrote in message
...
Hi
The data in my sheet is in the below mentioned format.

Column B
1 <Blank
2 <Blank
3 <Blank
4 <Blank
5 Total
6 2
7 4
8 6
9 <Blank
10 Total 12
I need to write a VBA code to hide rows that are blank and subsquently the
row that has field "Total"
Ex: Rows 1,2,3,4 are blank , so their "Total"-Row#5 is blank, so I need to
hide all these 5 rows.
In rows 6 to 10, row#9 is blank. So in this range, I need to hide only row # 9
I need to write a code that will satify both condition in a given range.

Please advise
Thanks