View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dean[_9_] Dean[_9_] is offline
external usenet poster
 
Posts: 24
Default Small runtime error - advice required

Hi, I am having a small issue with this piece of code. It seems to run
ok with the sheet unprotected however I need it to run with the sheet
protected.

This appears to be the offending line of code:

Rows(cell.Row).EntireRow.Hidden = True

Would appreciate any advice to correct.

Many Thanks,
Dean


Sub Macro4()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
ActiveSheet.DisplayPageBreaks = False
MsgBox "Labels Spooled to Printer" & Chr(13) & "Click OK to Proceed" &
Chr(10)
LR = Range("B991").End(xlUp).Row ' Determine the last used row
For Each cell In Range("B1:B" & CStr(LR))
If cell.Value = 0 Then
Rows(cell.Row).EntireRow.Hidden = True
End If
Next cell
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Cells.EntireRow.Hidden = False
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.Run Macro:="Macro6"
End Sub