Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Loop learning

Hiding entire row, if value in cell in column B is Yes.

Private Sub CAT()
Dim i As Long

For i = 1 To 25
If Cells(i, 2).Value = "Yes" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub

Instead of using i = 1 to 25, can't I use the Count property? How would I do
that?


--
Howard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Loop learning

Hi Howard

See the three delete macros on this page that use all a different loop
http://www.rondebruin.nl/delete.htm

The delete code start on the bottom and go up for hiding
you can use both ways

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Howard" wrote in message ...
Hiding entire row, if value in cell in column B is Yes.

Private Sub CAT()
Dim i As Long

For i = 1 To 25
If Cells(i, 2).Value = "Yes" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub

Instead of using i = 1 to 25, can't I use the Count property? How would I do
that?


--
Howard

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Loop learning

Something like this:

Private Sub CAT()
Dim i As Long

For i = 1 To Activesheet.UsedRange.SpecialCells(xlCellTypeLastC ell).Row
If Cells(i, 2).Value = "Yes" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub


"Howard" wrote:

Hiding entire row, if value in cell in column B is Yes.

Private Sub CAT()
Dim i As Long

For i = 1 To 25
If Cells(i, 2).Value = "Yes" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub

Instead of using i = 1 to 25, can't I use the Count property? How would I do
that?


--
Howard

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Loop learning

Thanks to both of you for advancing my limited knowledge!
--
Howard


"Ron de Bruin" wrote:

Hi Howard

See the three delete macros on this page that use all a different loop
http://www.rondebruin.nl/delete.htm

The delete code start on the bottom and go up for hiding
you can use both ways

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Howard" wrote in message ...
Hiding entire row, if value in cell in column B is Yes.

Private Sub CAT()
Dim i As Long

For i = 1 To 25
If Cells(i, 2).Value = "Yes" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub

Instead of using i = 1 to 25, can't I use the Count property? How would I do
that?


--
Howard


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
Learning VBA Neal Excel Programming 2 May 25th 06 06:45 PM
Learning VBA [email protected] Excel Programming 3 March 9th 06 04:42 AM
CDs and learning excel Tim Charts and Charting in Excel 0 November 30th 05 12:57 AM
Just learning VBA.. Deb Lang Excel Programming 1 October 22nd 03 11:46 PM
Learning VBA Randy Harris Excel Programming 2 September 6th 03 10:59 PM


All times are GMT +1. The time now is 06:46 AM.

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"