Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |