ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help needed editing a script (https://www.excelbanter.com/excel-programming/441736-re-help-needed-editing-script.html)

EagerGit

Help needed editing a script
 
Is there any way to make it faster? takes ages
otherwise its working PERFECT.
thanks

"Mike H" wrote in message
...
Hi,

Is this what you mean

Sub HURows()
Dim BeginRow As Long, EndRow As Long
Dim ChkCol As Long
BeginRow = 2
EndRow = 1197
ChkCol = 1
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value < "hide" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Else
Rows(RowCnt & ":" & EndRow).EntireRow.Hidden = True
Exit For
End If
Next RowCnt
Application.ScreenUpdating = True
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"EagerGit" wrote:

hi there
I using using this script to hide rows which working fine.
I would like add to it to hide Entire row PLUS every row below it upto
1197.
how can I achieve that??

Thanks in advance

Sub HURows()
BeginRow = 2
EndRow = 1197
ChkCol = 1

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "hide" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub



.


joel[_903_]

Help needed editing a script
 

Try my code it was designed to run fasters. the code unhides
everything in one instruction and then hides everything in a second
instruction.


Sub HURows()
BeginRow = 2
EndRow = 1197
ChkCol = 1

'unhide all rows
Rows(RowCnt & ":" & EndRow).Hidden = False
'find 1st occurance of hide and then hide all rows until end
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "hide" Then
Rows(RowCnt & ":" & EndRow).Hidden = True
exit For
End If
Next RowCnt
End Sub
Yesterday 09:30 AM


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=195793

http://www.thecodecage.com/forumz



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

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