Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 1004

Status
Not open for further replies.

kleimer

Programmer
Jul 30, 2003
1
US
I'm trying to collect my macros in one Workbook so they maybe run from any other Workbook without being in that Workbook. The following code runs fine from within the current Workbook but give" Run-time error 1004:Unable to set the Hidden property of the Range Class" from another Workbook.
Application.ScreenUpdating = False
ActiveSheet.Unprotect
For Each b In Range("BA35:BA43")
If b = "" Then
b.EntireRow.Hidden = True
End If
Next b
What am I doing wrong??
 
You are b-ing lazy (grin). Here is the corrected code. Note my additions :-

For Each b In Range("BA35:BA43").Cells
If b.Value = "" Then
b.EntireRow.Hidden = True
End If
Next b

Your code may not work correctly if the cell content is numeric. (alternative : If b.Value = 0 )

Regards
BrianB
** Let us know if you get something that works !
================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top