Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Repetition of Code

I need to repeat the following code for rows 1 to 135. If the value of the
cell in Column G is false, I need to hide the whole row. Rather than type in
masses of code, can anyone suggect some sort of loop to repeat 135 times.

If Worksheets("Quote").Range("G1") = False Then
Worksheets("Quote").Rows("1").Hidden = True
End If

Many thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Repetition of Code

Try something like this...

Sub HideRows()
Dim intCounter As Integer

With Sheets("Sheet2")
For intCounter = 1 To 135
If .Cells(intCounter, "G").Value = False Then _
.Rows(intCounter).Hidden = True
Next intCounter
End With
End Sub
--
HTH...

Jim Thomlinson


"Steve" wrote:

I need to repeat the following code for rows 1 to 135. If the value of the
cell in Column G is false, I need to hide the whole row. Rather than type in
masses of code, can anyone suggect some sort of loop to repeat 135 times.

If Worksheets("Quote").Range("G1") = False Then
Worksheets("Quote").Rows("1").Hidden = True
End If

Many thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Repetition of Code

That works great. Many thanks

"Jim Thomlinson" wrote:

Try something like this...

Sub HideRows()
Dim intCounter As Integer

With Sheets("Sheet2")
For intCounter = 1 To 135
If .Cells(intCounter, "G").Value = False Then _
.Rows(intCounter).Hidden = True
Next intCounter
End With
End Sub
--
HTH...

Jim Thomlinson


"Steve" wrote:

I need to repeat the following code for rows 1 to 135. If the value of the
cell in Column G is false, I need to hide the whole row. Rather than type in
masses of code, can anyone suggect some sort of loop to repeat 135 times.

If Worksheets("Quote").Range("G1") = False Then
Worksheets("Quote").Rows("1").Hidden = True
End If

Many thanks

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
Looking up the value corresponding to the last repetition in a ran PaladinWhite Excel Worksheet Functions 1 April 1st 08 02:16 AM
Random number with no repetition? Terry Pinnell Excel Discussion (Misc queries) 2 June 10th 07 11:10 AM
repetition cases Omar Excel Discussion (Misc queries) 2 May 9th 07 09:17 PM
PivotTable - Repetition of rows sailor-1 Excel Discussion (Misc queries) 1 January 5th 07 03:41 PM
check for repetition of cell contents David Excel Worksheet Functions 1 September 14th 06 09:31 AM


All times are GMT +1. The time now is 11:23 AM.

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

About Us

"It's about Microsoft Excel"