View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Hide Rows and Columns

As written:
Sheets("Sheet1").Rows("lastrw:65536").Hidden = True

will just give you an error unless you have a defined name "lastrw"

--
Regards,
Tom Ogilvy

"sameerce " wrote in message
...
Hey for finding the last row which has the data you can use the
following.
lastrw = Cells(Rows.Count, "B").End(xlUp).Row

It checks in the column "B" for data and gives the last row.

Based on this, you can use the following for hiding the rows
Sheets("Sheet1").Rows("lastrw:65536").Hidden = True

Hope this helps.

Sameer


---
Message posted from http://www.ExcelForum.com/