LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Hide/Unhide Rows

Hello
I am using the following code to hide/unhide rows:
Private Sub CommandButton1_Click()

Application.ScreenUpdating = False
Dim I As Long
Dim Hidden As Boolean
' For i = 14 To Cells(Rows.Count, "A").End(xlUp).Row
For I = 14 To 83
If Rows(I).EntireRow.Hidden Then
Hidden = True
Rows(I).EntireRow.Hidden = False
End If
Next I
If Hidden Then Exit Sub
' For i = 14 To Cells(Rows.Count, "A").End(xlUp).Row
For I = 14 To 83
If Cells(I, 1).Value < "BA" Then
' Range(Cells(I, 1), Cells(I + 9, 1)).EntireRow.Hidden = True
Rows(I).Hidden = True
End If
Next I
End Sub

This works fine up to 83 rows. I am trying to modify to use the last row
istead of hard coded row number. My attempts to modify (which arent working)
have been commented out. What am I doing wrong?
Thanks
 
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
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
How to Hide and Unhide Rows Jonno Excel Discussion (Misc queries) 2 June 9th 09 04:34 PM
Hide Unhide Rows blackstar Excel Discussion (Misc queries) 2 February 6th 06 09:36 PM
Hide/Unhide rows lennyx2 Excel Programming 3 May 24th 05 07:11 PM
How to hide and unhide rows Michael168[_10_] Excel Programming 1 October 6th 03 11:52 AM


All times are GMT +1. The time now is 03:10 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"