Run-Time error 424 Object required

Dspace

New Member
Joined
Nov 2, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
Think I've got a simple error here. I keep getting the Object required error on the following.

Sub UnHideITSC()
ActiveSheet.Unprotect Password:="test$"
For Each cell In Range("b14:b405")
If cell.Value = 1 Then
entire.Row.unHidden
Else: entire.Row.Hidden
End If
Next cell
ActiveSheet.Protect Password:="test$"
End Sub

I know its going to be something simple but its really aggravating me. Thanks!
Don't forget to vote tomorrow!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,729
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
Sub UnHideITSC()
ActiveSheet.Unprotect Password:="test$"
For Each cell In Range("b14:b405")
   If cell.Value = 1 Then
      cell.EntireRow.Hidden = False
   Else
      cell.EntireRow.Hidden = True
   End If
   Next cell
ActiveSheet.Protect Password:="test$"
End Sub
 
Solution

nemmi69

Active Member
Joined
Mar 15, 2012
Messages
482
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Try

VBA Code:
Sub UnHideITSC()
ActiveSheet.Unprotect Password:="test$"
For Each cell In Range("b14:b405")
    If cell.Value = 1 Then
        Rows(cell.Row).Hidden = False
    Else
        Rows(cell.Row).Hidden = True
    End If
Next cell
ActiveSheet.Protect Password:="test$"
End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,729
Office Version
  1. 365
Platform
  1. Windows
You can also get rid of the If like
VBA Code:
Sub UnHideITSC()
ActiveSheet.Unprotect Password:="test$"
For Each cell In Range("b14:b405")
   cell.EntireRow.Hidden = cell.Value <> 1
Next cell
ActiveSheet.Protect Password:="test$"
End Sub
 

Dspace

New Member
Joined
Nov 2, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Thank you all!
My forehead & monitor thank you! (They were about to meet at fast speeds)
Just learning to expand my VBA knowledge.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,729
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

nemmi69

Active Member
Joined
Mar 15, 2012
Messages
482
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
your welcome
 

Watch MrExcel Video

Forum statistics

Threads
1,129,941
Messages
5,639,103
Members
417,072
Latest member
JaimeDee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top