Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Help with Macro

The following Macro is set up to hide 3 rows based on a cell reference. I now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Help with Macro

As a guess

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 5
Set rng = Cells(i + 4, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(5).EntireRow.Hidden = True
End If
Next
End Sub

Hard to tell without knowing your sheet...

--
HTH...

Jim Thomlinson


"Steve" wrote:

The following Macro is set up to hide 3 rows based on a cell reference. I now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Help with Macro

Replace "Step 3" with "Step 5"....

"Steve" wrote in message
...
The following Macro is set up to hide 3 rows based on a cell reference. I

now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Help with Macro

Worked great. Thanks for the quick response.

Steve

"Jim Thomlinson" wrote:

As a guess

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 5
Set rng = Cells(i + 4, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(5).EntireRow.Hidden = True
End If
Next
End Sub

Hard to tell without knowing your sheet...

--
HTH...

Jim Thomlinson


"Steve" wrote:

The following Macro is set up to hide 3 rows based on a cell reference. I now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Help with Macro

Sorry I should have mentioned in my previous post that 130 is probably no
longer the correct number and needs to be changed. The code I posted will be
a problem as the number 130 will never actually be reached. It will be
something like 132 or 137 or something like that...
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

As a guess

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 5
Set rng = Cells(i + 4, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(5).EntireRow.Hidden = True
End If
Next
End Sub

Hard to tell without knowing your sheet...

--
HTH...

Jim Thomlinson


"Steve" wrote:

The following Macro is set up to hide 3 rows based on a cell reference. I now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Help with Macro

Would this work?

Sub HideStuff()
Dim R 'Row
Const k As Long = 5

For R = 7 To 130 Step k
Rows(R).Resize(k).Hidden = (Cells(R + k - 1, 3) = vbNullString)
Next
End Sub

HTH :)
--
Dana DeLouis
Win XP & Office 2003


"Steve" wrote in message
...
The following Macro is set up to hide 3 rows based on a cell reference. I
now
need to change to hide 5 rows. Can anyone help me adjust it?

Sub HideStuff()
Dim rng As Range
For i = 7 To 130 Step 3
Set rng = Cells(i + 2, 3)
If rng.Value = "" Then
Cells(i, 1).Resize(3).EntireRow.Hidden = True
End If
Next
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 06:32 AM.

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

About Us

"It's about Microsoft Excel"