View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] james.billy@gmail.com is offline
external usenet poster
 
Posts: 69
Default hiding unused rows using macros

On 28 Nov, 23:08, wrote:
On 28 Nov, 22:48, wrote:

Hi all,


I'm having an issue making a macro to hide all unused rows from the
very last row possible to the last row with data in it. This is to be
used with imported data that will not be the same size every time its
imported. Can anyone help me?


-Cindy


Here is an example of code that should do what you need:

Sub HideUnusedCode:

Range("A" & Cells(65536,1).end(xlup).row & ":A65536).entirerow.hidden
= true

End Sub

James


Third time lucky:

Sub HideUnusedCode:

Range("A" & Cells(65536,1).end(xlup).row &
":A65536").entirerow.hidden
= true

End Sub

This will be correct for all versions of Excel except Excel 2007, post
back if you will be using that version.

James