A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

macro for hiding rows



 
 
Thread Tools Display Modes
  #1  
Old February 11th, 2009, 04:48 AM posted to microsoft.public.excel.newusers
Khardy3352
external usenet poster
 
Posts: 20
Default macro for hiding rows

Can you help me write a macro that will automatically hide every third row?
  #2  
Old February 11th, 2009, 05:36 AM posted to microsoft.public.excel.newusers
Sheeloo[_3_]
external usenet poster
 
Posts: 1,713
Default macro for hiding rows

Try

Sub hideRows()
For i = 3 To 99 Step 3
Rows(i).EntireRow.Hidden = True
Next
End Sub

Change 99 to the value you want...

"Khardy3352" wrote:

Can you help me write a macro that will automatically hide every third row?

  #3  
Old February 11th, 2009, 05:37 AM posted to microsoft.public.excel.newusers
Sheeloo[_3_]
external usenet poster
 
Posts: 1,713
Default macro for hiding rows

Try

Sub hideRows()
For i = 3 To 99 Step 3
Rows(i).EntireRow.Hidden = True
Next
End Sub

Change 99 to the value you want...

"Khardy3352" wrote:

Can you help me write a macro that will automatically hide every third row?

  #4  
Old February 11th, 2009, 04:00 PM posted to microsoft.public.excel.newusers
Shane Devenshire[_3_]
external usenet poster
 
Posts: 3,333
Default macro for hiding rows

Hi,

Here is some code that often runs faster than loops:

Sub InsertRows()
Selection = "=1/MOD(ROW(),3)"
Selection = Selection.Value
Selection.SpecialCells(xlCellTypeConstants, 16).EntireRow.Hidden = True
Selection.EntireColumn.Delete
End Sub

Just select a blank column down as far as you want the rows to be hidden and
run it.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Khardy3352" wrote:

Can you help me write a macro that will automatically hide every third row?

  #5  
Old February 11th, 2009, 07:41 PM posted to microsoft.public.excel.newusers
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
Default macro for hiding rows

Do you really want to delete the column or just clear it? My concern is if there are columns after the blank column that the user selects.

--
Rick (MVP - Excel)


"Shane Devenshire" wrote in message ...
Hi,

Here is some code that often runs faster than loops:

Sub InsertRows()
Selection = "=1/MOD(ROW(),3)"
Selection = Selection.Value
Selection.SpecialCells(xlCellTypeConstants, 16).EntireRow.Hidden = True
Selection.EntireColumn.Delete
End Sub

Just select a blank column down as far as you want the rows to be hidden and
run it.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Khardy3352" wrote:

Can you help me write a macro that will automatically hide every third row?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.