Prev: Userform LayoutNext: refresh listbox From: EagerGit on 15 Apr 2010 05:23 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 From: Mike H on 15 Apr 2010 06:21 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 > > > > . > From: Mike H on 15 Apr 2010 06:28 I forgot this line at the top of the code, it will speed things up Application.ScreenUpdating = False -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Mike H" wrote: > 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 > > > > > > > > . > > From: EagerGit on 16 Apr 2010 10:43 Brilliant thanks Mike H Does exactly what it says on the tin........ "Mike H" wrote in message news:6FEEF9C4-1ED7-4BE8-88D8-E4B426D0D53E(a)microsoft.com...> I forgot this line at the top of the code, it will speed things up > > Application.ScreenUpdating = False > -- > Mike > > When competing hypotheses are otherwise equal, adopt the hypothesis that > introduces the fewest assumptions while still sufficiently answering the > question. > > > "Mike H" wrote: > >> 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 >> > >> > >> > >> > . >> > From: EagerGit on 16 Apr 2010 11:39 Is there any way to make it faster? takes ages otherwise its working PERFECT. thanks "Mike H" wrote in message news:15CD59BF-8B17-4B5A-B439-AD62FCD82567(a)microsoft.com...> 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 >> >> >> >> . >>  |  Next  |  Last Pages: 1 2 Prev: Userform LayoutNext: refresh listbox