Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Hide Second Row - Relative (row number changes)

Hi All,

Should be easy -- I simply want to hide the second row, but that row number
may be two now, three later, and four after that.... How do I get it to not
care about the row number, yet hide the second visible row?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hide Second Row - Relative (row number changes)

Sub BBB()
Dim i As Long, j As Long
i = 0
j = 1
Do Until i = 2
If Cells(j, 1).EntireRow.Hidden = False Then
If i = 1 Then
Cells(j, 1).EntireRow.Hidden = True
i = i + 1
Exit Do
Else
i = i + 1
End If
End If
j = j + 1
Loop

End Sub

You could also probably use specialcells, but I would need to know more
about what is on your sheet and what you are doing. The above should be
sufficient.

--
Regards,
Tom Ogilvy




"JEFF" wrote in message
...
Hi All,

Should be easy -- I simply want to hide the second row, but that row

number
may be two now, three later, and four after that.... How do I get it to

not
care about the row number, yet hide the second visible row?

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Hide Second Row - Relative (row number changes)

Here's one way

Dim i As Long
Dim fVisible As Boolean

For i = 1 To Rows.Count
If Not Rows(i).Hidden Then
If fVisible Then
Rows(i).Hidden = True
Exit For
Else
fVisible = True
End If
End If
Next i


--

HTH

RP
(remove nothere from the email address if mailing direct)


"JEFF" wrote in message
...
Hi All,

Should be easy -- I simply want to hide the second row, but that row

number
may be two now, three later, and four after that.... How do I get it to

not
care about the row number, yet hide the second visible row?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Hide Second Row - Relative (row number changes)

Perfect...... Thanks gentlemen (I'm sure you have better things to do on a
Sunday, if not, could you briefly tell me what some of these commands mean?!)

"Tom Ogilvy" wrote:

Sub BBB()
Dim i As Long, j As Long
i = 0
j = 1
Do Until i = 2
If Cells(j, 1).EntireRow.Hidden = False Then
If i = 1 Then
Cells(j, 1).EntireRow.Hidden = True
i = i + 1
Exit Do
Else
i = i + 1
End If
End If
j = j + 1
Loop

End Sub

You could also probably use specialcells, but I would need to know more
about what is on your sheet and what you are doing. The above should be
sufficient.

--
Regards,
Tom Ogilvy




"JEFF" wrote in message
...
Hi All,

Should be easy -- I simply want to hide the second row, but that row

number
may be two now, three later, and four after that.... How do I get it to

not
care about the row number, yet hide the second visible row?

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
Date + relative number reference Derek M[_2_] Excel Worksheet Functions 3 April 26th 10 12:43 PM
HLOOKUP - Relative cell reference in row index number Nick Excel Discussion (Misc queries) 0 November 13th 09 12:50 PM
how do i make a sheet number relative in a formula DCook Excel Worksheet Functions 3 September 1st 09 05:43 PM
How do I hide the Check Box number? ctyclrk Excel Worksheet Functions 2 April 25th 08 06:34 PM
Column picked randomly with probability relative to number of entr Neil Goldwasser Excel Worksheet Functions 4 May 30th 06 08:55 AM


All times are GMT +1. The time now is 11:41 PM.

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"