Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Small runtime error - advice required

Have a look at the Protect Method in help. Here is an excerpt:

-----------------------------------
UserInterfaceOnly Optional Variant. True to protect the user interface, but
not macros. If this argument is omitted, protection applies both to macros
and to the user interface.

If you apply the Protect method with the UserInterfaceOnly argument set to
True to a worksheet and then save the workbook, the entire worksheet (not
just the interface) will be fully protected when you reopen the workbook. To
re-enable the user interface protection after the workbook is opened, you
must again apply the Protect method with UserInterfaceOnly set to True.
--------------------------------

You must set this property each time the workbook is opened.

--
Damon Longworth

2006 UK Excel User Conference
July 19/21st, 2006
University of Westminster - Marylebone Campus
London, England
Early Bird Registration Now Open!!
http://www.exceluserconference.com/2006UKEUC.html

2006 East Coast Excel User Conference
April 19/21st, 2006
Holiday Inn, Boardwalk
Atlantic City, New Jersey
It's not too late to register!
http://www.exceluserconference.com/2006ECEUC.html


"Dean" wrote in message
oups.com...
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


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
Runtime error '424': Object Required loren.pottinger Excel Discussion (Misc queries) 1 August 28th 06 09:56 PM
Runtime error 424 - Object required periro16[_8_] Excel Programming 1 September 21st 05 05:36 PM
Runtime error only with Office 97 - advice required Kennyatwork Excel Programming 2 May 12th 04 02:11 AM
runtime error ....object required mlm Excel Programming 3 February 18th 04 06:09 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


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