ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hiding unused rows using macros (https://www.excelbanter.com/excel-programming/401881-hiding-unused-rows-using-macros.html)

[email protected]

hiding unused rows using macros
 
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

[email protected]

hiding unused rows using macros
 
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:

Sub HideUnusedRows

[email protected]

hiding unused rows using macros
 
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

[email protected]

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


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com