Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default This used to work...

Sub CloseRows()

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim ws As Worksheet

Sheets("Sheet 1").Select

For Each ws In ThisWorkbook.Worksheets
With ws
..Unprotect Password:="*****"
'.Columns("A:W").AutoFit

For i = 31 To 1000
..Cells.EntireRow.Hidden = False
If .Cells(i, 1).Value = "" Then
..Cells(i, 1).EntireRow.Hidden = True
End If
Next i
End With
Next ws



'For Each ws In ThisWorkbook.Worksheets
'ws.Protect Password:="*****", AllowFormattingCells:=True,
AllowFormattingColumns:=True, DrawingObjects:=False, Contents:=True
'Next ws

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub

But now it does nothing. I think I may have changed a setting?

Help. this is silly.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default This used to work...

Make sure your Macro Security level is low or medium

worksheet menu - Tools - Macro - Security

I would think any other reason for it not working would produce an error
messsage. If the Password was wrong for example.

"Stephen" wrote:

Sub CloseRows()

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim ws As Worksheet

Sheets("Sheet 1").Select

For Each ws In ThisWorkbook.Worksheets
With ws
.Unprotect Password:="*****"
'.Columns("A:W").AutoFit

For i = 31 To 1000
.Cells.EntireRow.Hidden = False
If .Cells(i, 1).Value = "" Then
.Cells(i, 1).EntireRow.Hidden = True
End If
Next i
End With
Next ws



'For Each ws In ThisWorkbook.Worksheets
'ws.Protect Password:="*****", AllowFormattingCells:=True,
AllowFormattingColumns:=True, DrawingObjects:=False, Contents:=True
'Next ws

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub

But now it does nothing. I think I may have changed a setting?

Help. this is silly.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default This used to work...

Found it!

For i = 31 To 1000
..Cells.EntireRow.Hidden = False

should have been simply

For i = 31 To 1000






"Joel" wrote:

Make sure your Macro Security level is low or medium

worksheet menu - Tools - Macro - Security

I would think any other reason for it not working would produce an error
messsage. If the Password was wrong for example.

"Stephen" wrote:

Sub CloseRows()

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim ws As Worksheet

Sheets("Sheet 1").Select

For Each ws In ThisWorkbook.Worksheets
With ws
.Unprotect Password:="*****"
'.Columns("A:W").AutoFit

For i = 31 To 1000
.Cells.EntireRow.Hidden = False
If .Cells(i, 1).Value = "" Then
.Cells(i, 1).EntireRow.Hidden = True
End If
Next i
End With
Next ws



'For Each ws In ThisWorkbook.Worksheets
'ws.Protect Password:="*****", AllowFormattingCells:=True,
AllowFormattingColumns:=True, DrawingObjects:=False, Contents:=True
'Next ws

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub

But now it does nothing. I think I may have changed a setting?

Help. this is silly.

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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


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